Hello,
I hope that this post is not misplaced in troubleshooting, please move if so.
I try to make a really simple shader with JME from SVN (from last week). I am a beginner so its possible i made something wrong.
Ok, here is my Problem:
My Shaders:
noise.vert
uniform vec3 LP;
uniform vec3 LightPosition;
uniform vec3 SurfaceColor;
uniform float ScaleIn;
uniform float ScaleOut;
varying vec4 Color;
void main() {
vec3 normal = gl_Normal;
vec3 vertex = gl_Vertex.xyz + noise3(LP + gl_Vertex.xyz * ScaleIn ) * ScaleOut;
normal = normalize(gl_NormalMatrix * normal);
vec3 position = vec3(gl_ModelViewMatrix * vec4(vertex,1.0));
vec3 lightVec = normalize(LightPosition - position);
float diffuse = max(dot(lightVec, normal), 0.0);
if (diffuse < 0.125)
diffuse = 0.125;
Color = vec4(SurfaceColor * diffuse, 1.0);
gl_Position = gl_ModelViewProjectionMatrix * vec4(vertex,1.0);
}
noise.frag
varying vec4 Color;
void main () {
//gl_FragColor = vec4(1,0,0,1);
gl_FragColor = Color;
}
My workaround is made like the examples, and if i set gl_FragColor = vec4(1,0,0,1); in fragment shader my sphere in the scene is red. That proofs the shader are ok and work on my nvidia.
But when i want to set the uniform vars in my doRender(Renderer r) Method:
glslShader.setUniform("LP", this.offset);
glslShader.setUniform("SurfaceColor",new Vector3f(1,0,0));
glslShader.setUniform("LightPosition",new Vector3f(10,10,10));
glslShader.setUniform("ScaleIn",5f);
glslShader.setUniform("ScaleOut",15f);
r.draw(myNode);
i got that error on and on in my console log:
SCHWERWIEGEND: Shader uniform [LP] could not be located in shader
06.05.2008 22:52:24 com.jme.scene.state.lwjgl.shader.LWJGLShaderUtil updateUniformLocation
SCHWERWIEGEND: Shader uniform [ScaleIn] could not be located in shader
06.05.2008 22:52:24 com.jme.scene.state.lwjgl.shader.LWJGLShaderUtil updateUniformLocation
SCHWERWIEGEND: Shader uniform [ScaleOut] could not be located in shader
(SCHWERWIEGEND is german and means a serious matter or error in english)
I double-proofed every single character and don't understand why SurfaceColor and LightPosition make no problem and the other three uniform vars cannot be found ?
what do i wrong ? What can i do ?
If needed i will post more of my code, but thats the code parts that matters in my opinion, the shader itself compiles and works on my sphere node in my scene. The scene contains just a sphere from jme and a standard light. There is not much i can do wrong.
any suggestions ?
thanks
Sebastian