Sign in to follow this  

Specular Effect on a Textured Face

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this