iDevGames Forums
GLLighting color problem - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: GLLighting color problem (/thread-3299.html)



GLLighting color problem - clapton541 - May 5, 2007 09:09 AM

Whenever I enable lighting with glEnable(GL_LIGHTING) all the colors on my polygons dissappear and they turn white(with lighting though). I'm using Nehe code as my base. Does anyone know how I can fix that?


GLLighting color problem - akb825 - May 5, 2007 10:41 AM

glEnable(GL_COLOR_MATERIAL)

Put that line in your setup code.


GLLighting color problem - OneSadCookie - May 5, 2007 05:59 PM

That seems a random thing to suggest... I don't see how it can help.

A more obvious question to ask might be "do you have normals? and are they normalized?"


GLLighting color problem - akb825 - May 5, 2007 07:31 PM

He is saying that the lighting works, it's just that his colors all reset to white. That's consistent with what happens if you don't have color materials enabled, since it ignores the vertex colors and instead uses the material color. (which is white by default)


GLLighting color problem - OneSadCookie - May 5, 2007 08:34 PM

Ah, right. I was assuming "white" meant "white", as opposed to "varying shades of gray depending on the angle to the light" Smile