HI everyone,
I'm trying to use a really basic per pixel lighting shader but nothing is working. I'm pretty sure it's because I cannot make this kind of call:
float Ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
So my question is: is there a way to get gl_FrontMaterial.ambient in the shader with jogl or I have to pass manually all the variables ( ambient, specular, diffuse ecc)?
Thanks
Bye
What stage of the shader are you using this in? The outcome of two vectors (mat and light’s ambient) will be a vec4, not a float. Vector multiplication is done component wise, to get a float, you’ll need to call the dot() function to get the dot-product.
Take a look at this article: http://gpwiki.org/index.php/OpenGL:Tutorials:Virtualized_Lights_with_OpenGL_and_GLSL. Porting it to jogl should be straight forward.