View Full Version : Vertex Color with Light
02-27-2009, 05:23 AM
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?
02-27-2009, 05:35 AM
Are you using any textures for your cube or in another part of your code?
02-27-2009, 05:53 AM
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.
02-27-2009, 06:17 AM
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 !
02-27-2009, 07:03 AM
That's great thanks.
So, just to confirm, vertex colors and lighting are mutually exclusive?
[EDIT] Ignore this, misread previous post
02-27-2009, 07:07 AM
Not at all.
02-27-2009, 07:23 AM
Not at all.
My Bad! Sorry - didn't read the original reply properly. Yes he is right and they are now working together :)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.