PDA

View Full Version : gl_FrontMaterial doesn't work



Henning Pohl
06-24-2005, 05:08 AM
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.

airseb
06-26-2005, 08:52 AM
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).

Henning Pohl
06-26-2005, 12:56 PM
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.

Henning Pohl
06-27-2005, 12:28 PM
OK. When I replace all if calls with step functions it works. I have no idea why, but whatever.