Use of undeclared identifier. . . . . help with slab shader
I decided to port this noise shader from shadertoy (https://www.shadertoy.com/view/MlSSRR) and am not compiling in the slab due to variable names, it seems. I'm declaring the variables in the shader, though?
I get these warnings from the max window:
jit.gl.slab: -- START GLSL INFO LOG: fp --
ERROR: 0:104: Use of undeclared identifier 'iResolution'
ERROR: 0:105: Use of undeclared identifier 'uv'
ERROR: 0:105: Use of undeclared identifier 'iResolution'
ERROR: 0:105: Use of undeclared identifier 'iResolution'
ERROR: 0:106: Use of undeclared identifier 'uv'
ERROR: 0:107: Use of undeclared identifier 't'
ERROR: 0:107: Use of undeclared identifier 't'
ERROR: 0:107: Use of undeclared identifier 't'
ERROR: 0:108: Use of undeclared identifier 'finalColor'
jit.gl.slab: -- END GLSL INFO LOG: fp --
jit.gl.slab: jit.gl.shader: GLSL program failed to compile.
Here's the shader:
//is this perlin? we'll find out after it's working
You are not declaring them, you are only handling the bindings in the xml header.
You need to declare them after the header:
uniform vec2 iResolution;
....
...
float hash(vec2 p)
{
return fract(sin(dot(p, vec2(15.79,81.93)))*45678.9123);
}
Thank you Luca Neil! Super exciting!
//is this perlin? we'll find out after it's working
Side note... Since you are in the fragment shader you don't need to declare varyings, only uniforms. Use varyings if you need to pass data from vertex or geom passes.
And it's easier to use the build in states:
have a look at:
Cool, thank you.