• Advertisement
Sign in to follow this  

Specular Effect on a Textured Face

This topic is 3138 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I am trying to create a shinning effect on a texture plan using OGL but all my trials have not been successful yet. When the plan is not texture i get a nice white spot on it reflecting the light and giving the glossy effect. But when i texture it i do not get that effect. How can i achieve it? These are my light settings
static const GLfloat lightDiffuseLamp[]   = { .8f, .8f, .8f, 1.f };
static const GLfloat lightSpecularLamp[]  = { 1.f, 1.f, 1.f, 1.f};
static const GLfloat lightPositionLamp[]  = { 1.0f, 1.f, 1.f, 1.f };
// Set up lamp.
glEnable( GL_LIGHTING );  
glLightfv( GL_LIGHT0, GL_DIFFUSE,  lightDiffuseLamp );
glLightfv( GL_LIGHT0, GL_SPECULAR, lightSpecularLamp );
glLightfv( GL_LIGHT0, GL_POSITION, lightPositionLamp );
glEnable( GL_LIGHT0 );
These are my texture settings
glGenTextures( 1, &iTexturesID[ECenterImg] );	
glBindTexture( GL_TEXTURE_2D, iTexturesID[ECenterImg] );
glTexImage2D(  GL_TEXTURE_2D, 0, GL_RGB, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)texPtr );
These are the material settings:
static GLfloat objDiffuseWhite[]  = { 1.f, 1.f, 1.f, 1.f};
static GLfloat objSpecularWhite[] = { 1.f, 1.f, 1.f, 1.f };

glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR,  objSpecularWhite);
glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE,  objDiffuseWhite);
glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS,  128.0f);
Many thanks in advance AF

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement