View Full Version : lighting removes colors..??
02-11-2001, 03:21 PM
iīm writing a pretty simple demo with a few colored objects flying around. i use one white light source (inifinte viewpoint mode) with some ambient. now if i turn the lighting on, my objects get shaded very pretty but all the color is gone, everything's gone grey-toned.
what do i have to do, iīve defined normal vectors for all vertices, defined materials for the polygons and set the shading model to smooth but i canīt find the reason why lighting removes all the color.
Usually when this happens it is because you were specifying colors using glColor, not materials. When that is the case, you can fix it with a glEnable(GL_COLOR_MATERIAL).
Since you said in your post that you are specifying material properties, the only thing I can think of is that somehow you're not specifying them correctly.
Sorry I can't be any more specific than that.
02-12-2001, 12:59 AM
ok, enabling GL_COLOR_MATERIAL brings back the color, but now all the pretty shading of my glutSolidSphere is gone, itīs back to plain white...
02-12-2001, 06:19 AM
By any chance did you use glColor for your polygons and glMaterial for your glutSolidSphere? You can only use one method. glMaterial is generally preferrable unless you have to change the vertex material properties a lot.
02-13-2001, 01:58 AM
Also, if you use glScale you'll have to enable normalization of the lighting normals for the lighting equation to work correctly. Otherwise they might be too long and stuff will be mostly white.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.