Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't run glslify example #175

Open
mikeny07 opened this issue Sep 18, 2023 · 5 comments
Open

can't run glslify example #175

mikeny07 opened this issue Sep 18, 2023 · 5 comments

Comments

@mikeny07
Copy link

mikeny07 commented Sep 18, 2023

Most examples in the demos directory run smoothly without any issue. However, the glslify.glsl example:

#pragma glslify: snoise = require('glsl-noise/simplex/2d')

float noise(in vec2 pt) {
    return snoise(pt) * 0.5 + 0.5;
}

void main () {
    float r = noise(gl_FragCoord.xy * 0.01);
    float g = noise(gl_FragCoord.xy * 0.01 + 100.0);
    float b = noise(gl_FragCoord.xy * 0.01 + 300.0);
    gl_FragColor = vec4(r, g, b, 1);
}

The noise function in the above code gives error:

'snoise' : no matching overloaded function found

I checked the glslify package was installed in the node_modules folder.

@Malacath-92
Copy link
Collaborator

Did you enable the glslify option in the settings?

@mikeny07
Copy link
Author

Sorry. I just enabled it. However, I got a different error:

 Line numbers are not available because the glslify option is enabled
THREE.WebGLShader: gl.getShaderInfoLog() fragment WARNING: 0:153: 'glslify' : unrecognized pragma
'snoise' : no matching overloaded function found

@Malacath-92
Copy link
Collaborator

That sounds like perhaps you didn't install the noise module?

@Malacath-92
Copy link
Collaborator

I took a closer look at this just now and it seems that glslify uses the working directory as the root for finding modules, which is the folder where the extension is installed, so that's gonna do no good. Idk when that changed, but I'm pretty sure it worked once in the past. Either way I'll fix that.

@Malacath-92
Copy link
Collaborator

Fixed it, if a folder is open it will use that as a base directory, otherwise the folder that the file being rendered is in. That fix will be part of the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants