Dear All,
I’m trying to make shiny highlights on my objects. After reading tutorials I do the following:
-- Initialiation --
glShadeModel(GL_SMOOTH);
glClearDepth(1.0);
glClearColor(bg_color[0], bg_color[1], bg_color[2], 0.0);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LEQUAL);
// Light
GLfloat LightAmbient[]= { 0.2f, 0.2f, 0.2f, 1.0f }; //Ambient light
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values
GLfloat LightSpecular[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values
GLfloat LightPosition[]= { 100.0f, 100.0f, 130.0f, 1.0f }; // Light Position
glEnable( GL_LIGHT0 );
glEnable( GL_LIGHTING ) ;
glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient); // Setup The Ambient Light
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light
glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular); // Specular light
glLightfv(GL_LIGHT0, GL_POSITION, LightPosition); // Position The Light
glEnable ( GL_COLOR_MATERIAL ) ;
glColorMaterial ( GL_FRONT, GL_AMBIENT_AND_DIFFUSE ) ;
-- Rendering code ---
glPushMatrix();
glColor4f(R,G,B,1.0);
glMaterialf(GL_FRONT, GL_SHININESS, 128);
gluSphere(quadric,sz,16,16);
glPopMatrix();
I can’t see any shiny spots. Changing the shininess value makes no effect. I can’t find an error :mad:
Any help is very appreciated!