glColor*f()

Started by
4 comments, last by Geometrian 16 years, 2 months ago
Hi! In my OpenGL programs I have noticed a phenomenon which completely baffles me and is really annoying. glColor4f() and glColor3f() don't work when there's lighting. If I draw what should be a red cube, it is red until the lights come on. Then it is shades of grey. To fix this, I have made textures, one pixel big with my desired color on them. Texturing the objects than gives the effect I want. I am certain this is not the right way to fix this problem. How do I fix it then? Thanks, Geometrian [Edited by - Geometrian on February 16, 2008 7:10:50 PM]

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Advertisement
You probably want the glMaterial family of functions.
I played around with some functions, but I didn't get it to work, and I'm not sure what you mean.

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Look at glColorMaterial()
Read and absorb.
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
Thanks, everyone!
This fixed it:
glEnable(GL_COLOR_MATERIAL)glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE)
That, and turning on lighting.
Thanks again!
G

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

This topic is closed to new replies.

Advertisement