PDA

View Full Version : disabling color material



Lev
08-28-2002, 05:58 AM
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.

Cheers,
-Lev

harsman
08-28-2002, 06: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.

Lev
08-28-2002, 06:42 AM
well but glDisable(GL_COLOR_MATERIAL) should disable the color material so that it does not affect the lighting shouldn't it?

harsman
08-28-2002, 07: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).]

Lev
08-28-2002, 07:06 AM
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.

-Lev

[This message has been edited by Lev (edited 08-28-2002).]

harsman
08-28-2002, 07: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.

Lev
08-28-2002, 07:34 AM
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?

-Lev

Lev
08-28-2002, 07:36 AM
ok forget that stupid thread http://www.opengl.org/discussion_boards/ubb/smile.gif

-Lev

P.S. I should have read the manual in detail before asking http://www.opengl.org/discussion_boards/ubb/wink.gif