Stack Overflow
01-04-2003, 08:23 AM
So far I have a code that displays a white light, and I would like to change the color of the lights.
GLfloat specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat shininess[] = { 50.0 };
GLfloat position[] = { 1.0, 1.0, 1.0, 0.0 };
glPushMatrix();
glMaterialfv ( GL_FRONT, GL_SPECULAR, specular );
glMaterialfv ( GL_FRONT, GL_SHININESS, shininess );
glLightfv ( GL_LIGHT0, GL_POSITION, position );
glTranslated( 0.0, 0.0, 5.0 );
glDisable( GL_LIGHTING );
glColor3f( 0.0, 1.0, 0.0 );
glutWireCube( 0.1 );
glEnable( GL_LIGHTING );
glPopMatrix();
How do I change the Light color?
- VC6-OGL
GLfloat specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat shininess[] = { 50.0 };
GLfloat position[] = { 1.0, 1.0, 1.0, 0.0 };
glPushMatrix();
glMaterialfv ( GL_FRONT, GL_SPECULAR, specular );
glMaterialfv ( GL_FRONT, GL_SHININESS, shininess );
glLightfv ( GL_LIGHT0, GL_POSITION, position );
glTranslated( 0.0, 0.0, 5.0 );
glDisable( GL_LIGHTING );
glColor3f( 0.0, 1.0, 0.0 );
glutWireCube( 0.1 );
glEnable( GL_LIGHTING );
glPopMatrix();
How do I change the Light color?
- VC6-OGL