Advertisement

Lighting vs. colors

Started by February 20, 2003 05:45 PM
3 comments, last by PinkCactus 22 years ago
hi there i''m pretty new in the whole opengl issue, so please excuse my question if it''s a dumb one, but i don''t have enough time to figure this out on my own... the problem i have it that, using lighting (GL_LIGHTING enabled) with only GL_LIGHT1 set to ambient and diffuse lighting, any colors set using glColor3f or glColor4f (i assume the others as well, but i''m only using those) don''t affect anything drawn. what do i need to do to bring the coloring back to life? i''m very glad for every helpful response!!! thanx in advance simon
glEnable(GL_COLOR_MATERIAL);



Looking for a serious game project?
www.xgameproject.com

Looking for a serious game project?
www.xgameproject.com
Advertisement
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); /* already in that state, by default */
glEnable(GL_COLOR_MATERIAL);

Later, call glDisable(GL_COLOR_MATERIAL) if needed.

LOL
wow, those were some quick answers!

thanks a lot. i remember coming across that command in some tutorial, but i didn''t feel like reading through all of those again because of this little issue. anyway, i added that one line and it works, but guess what, now all my drawing is blue :-) i guess i''ll have to set the color to full intensity before drawing the textured objects :-)

thanks again!
simon

This topic is closed to new replies.

Advertisement