Vertex Color with Light

Hi, I have a simple cube that has vertex colors and normals. With no lighting (lighting altogether disabled) the vertex colors show fine. With lighting turned on the vertex colors don’t show.

The lighting looks fine, but I thought it would ‘add’ to the vertex coloring, not remove it. Saying that, I haven’t set up any material properties, could that be it?

Thanks

David

Are you using any textures for your cube or in another part of your code?

No not at all.

Without the lights being enabled very little else is being done but definitely no textures, or texture coordinates - I haven’t even set up any texture states.

with light u have to use color material glColorMaterial or glmaterial.
color material define how ur materials or bodies will react under lights .
with glColorMaterial u have to call glEnable(GL_COLOR_MATERIAL) then u change the current color using glColor.

and also dont forget to enable the lighting !

That’s great thanks.

So, just to confirm, vertex colors and lighting are mutually exclusive?

[EDIT] Ignore this, misread previous post

Not at all.

My Bad! Sorry - didn’t read the original reply properly. Yes he is right and they are now working together :slight_smile: