View Full Version : disabling color material
I have soem problems disabling color material (GL_COLOR_MATERIAL) (lighting is enabled)
if I enable the color material and set the color to 'C' , render something, and then disable color material the rendering look just the same as with enabled color material and color C.
any calls to glColor do not change the color (as it should be the case).
I've made some screenshots that illustrate the problem:
http://www.levp.de/screens/colormat_not_enabled.jpg http://www.levp.de/screens/colormat_enabled.jpg http://www.levp.de/screens/colormat_enabled_then_disabled.jpg
I'm using a GF2 on WinXP with 3082 drivers.
Seem like a driver bug actually.
08-28-2002, 07:23 AM
Unless you disable lighting, won't the previously set material (set via glColor calls and colour amterial) still be active? If you want to change the material (which is what affects the colour if lighting is enabled) then do some glMaterial* calls. But maybe I misunderstood you.
well but glDisable(GL_COLOR_MATERIAL) should disable the color material so that it does not affect the lighting shouldn't it?
08-28-2002, 08:00 AM
Uh, no. OpenGL is a state machine remember? If you set the material to something it remains that way until you set it to something else. Now you set the material state using cglColor calls and color material. Disabling color material just means you have to set the material with regular glMaterial* calls. glColor doesn't work when you have lighting enabled, you have to set the material. Like I said, if you want a flat color, disable lighting and use glColor.
[This message has been edited by harsman (edited 08-28-2002).]
I disagree. glDisable(GL_COLOR_MATERIAL) should disable the color material.
I want lighting _without_ color material. I can get this if I just call enable lighting. But if I enabled color material once disabling it doesn't work properly.
[This message has been edited by Lev (edited 08-28-2002).]
08-28-2002, 08:26 AM
Well you have the right to disagree, but it doesn't wotk that way. Check the spec on lighting if you don't believe me. Heck, I'll quote (this is from the section on color material):
The replacements made to material prop-erties
are permanent; the replaced values remain until changed by either sending a
new color or by setting a new material value when ColorMaterial is not currently
enabled to override that particular value.
Color material is not a special material property, materials specified with glMaterial* can have color too, it's just a different way of submitting material properties. If you see it that way it seems pretty logical and consistent with the rest of gl's design if you ask me.
hm well ok http://www.opengl.org/discussion_boards/ubb/smile.gif
then I have a question:
assume I called glEnable(GL_COLOR_MATERIAL) somewhere in my program.
How can I get lighting without any materials?
ok forget that stupid thread http://www.opengl.org/discussion_boards/ubb/smile.gif
P.S. I should have read the manual in detail before asking http://www.opengl.org/discussion_boards/ubb/wink.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.