gl_FrontMaterial doesn't work

Hi

I’m trying to implement phong shading via GLSL. The shader itself was quite easy. I used Shader Designer and in there it works just fine. When I integrate the shader in a project however it doesn’t work alright. The scene data is stored in a display list and appropriate lights and materials are set. When using fixed function rendering this works correctly. But when the shader is activated before invoking the display list the screen is only white.
I changed the shader to output only the gl_FrontMaterial.diffuse channel and it is all white. For some reason the material informations aren’t passed to the shader. This kind of freaks me out because I can’t find out why they aren’t. As I said the same shader works inside Shader Designer and the very same display list works with fixed function shading. I already tried updating my device drivers, but they didn’t seem to be the problem.
Anybody with an idea out there on how to fix this? Any help is highly appreciated.

it’s just the screen which is white or your model ? have you tried to change the background in order to see if your model appears ?
Otherwise, when you activate a shader, texturing with fixed pipeline is disabled (in this case you have to implement it with your shader).
Try also to check if your model isn’t lighted too much. You can try to change the attenuation value(s).

Only the model is white. On some parts the background shines through. As for propable lighting issues in the shader: At the moment the gl_FrontMaterial.diffuse value is directly written as the output color. So no shading or texturing is done in the shader.

OK. When I replace all if calls with step functions it works. I have no idea why, but whatever.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.