GLLighting color problem

clapton541
Unregistered
 
Post: #1
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?
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #2
glEnable(GL_COLOR_MATERIAL)

Put that line in your setup code.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
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?"
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #4
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)
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
Ah, right. I was assuming "white" meant "white", as opposed to "varying shades of gray depending on the angle to the light" Smile
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Problem with the graphics color on a videogame for iphone femmedragon 6 4,849 Dec 16, 2012 07:37 PM
Last Post: SethWillits
  ? Find color value of 'pixel' in color buffer? Elphaba 1 4,502 Jul 22, 2009 01:23 PM
Last Post: Bachus
  strange color problem leggo 12 5,995 Aug 27, 2004 08:36 AM
Last Post: leggo