PDA

View Full Version : lighting problem



thunder2001
03-31-2004, 02:46 PM
i draw a solidcube with glutSolidCube and enable the lighting.but i can't the effect of the lighting.
GLfloat mat_specular[]={0.5,0.5,0.5,1.0};
GLfloat mat_shininess[]={100.0};
GLfloat light_position1[]={1.0,1.0,1.0,1.0};
GLfloat light_position2[]={1.3,-0.8,1.0,1.0};
GLfloat white_light1[]={0.0,1.0,1.0,1.0};
GLfloat white_light2[]={1.0,1.0,1.0,1.0};
GLfloat diffuseMaterial[4]={0.61424,0.4136,0.4136};


glMaterialfv(GL_FRONT,GL_DIFFUSE,diffuseMaterial);
glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess);

glLightfv(GL_LIGHT0,GL_POSITION,light_position1);
glLightfv(GL_LIGHT0,GL_DIFFUSE,white_light1);
glLightfv(GL_LIGHT0,GL_SPECULAR,white_light1);
glLightfv

glLightfv(GL_LIGHT1,GL_POSITION,light_position2);
glLightfv(GL_LIGHT1,GL_DIFFUSE,white_light2);
glLightfv(GL_LIGHT1,GL_SPECULAR,white_light2);



glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);

glutSolidCube(0.3);

chowe6685
03-31-2004, 03:24 PM
I'm guessing its #2
http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/