glColorMaterial and lighting
i use lighting in my program and if put this two lines of code into rendering code suddenly lighting doesn''t seem to work any more.
IMHO this two lines shouldn''t have any effect on anything if they''re called in this order and there''s no code between them.
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_COLOR_MATERIAL);
I remember to have dealt with it few months ago. You''re wrong when you think it "shouldn''t have any effect on anything if they''re called in this order and there''s no code between them".
Darn, the search feature is broken. Please give me a few minutes to find the topic again.
Darn, the search feature is broken. Please give me a few minutes to find the topic again.
Ah, There it is ! Nothing replaces a good''ol brain 
At the exact moment when you call glEnable(GL_COLOR_MATERIAL), OpenGL affects the last know color (defined by glColor) to the last known material (defined by glColorMaterial).
That''s why calling glEnable(GL_COLOR_MATERIAL) DOES CHANGE SOMETHING even if you think that disabling it immediately would keep it safe.

At the exact moment when you call glEnable(GL_COLOR_MATERIAL), OpenGL affects the last know color (defined by glColor) to the last known material (defined by glColorMaterial).
That''s why calling glEnable(GL_COLOR_MATERIAL) DOES CHANGE SOMETHING even if you think that disabling it immediately would keep it safe.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement