PDA

View Full Version : light



grimoire
06-09-2004, 10:19 AM
I am messing around with the lighting chapter of The OpenGL Programming Guide and was wondering how do you change the ambient light to reflect the color of the object.
GLfloat ambient[]={1.0,0.0,1.0,1.0};
...
glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
...
glEnable(GL_AMBIENT);But how would you do it on a smooth shaded multi-colored polygon?

Aeluned
06-10-2004, 12:30 PM
look into glMaterialfv
and enable GL_COLOR_MATERIAL.

grimoire
06-10-2004, 01:24 PM
Thanx man works like a charm