darkrappey
11-23-2006, 12:02 AM
My intention is to use basic directional lighting.
I am implementing the light set up like so:
GLfloat lightDir[] = { 0.0, 1.0, 0.0, 0.0};
glLightfv(GL_LIGHT1, GL_POSITION, lightDir);
GLfloat ambientProperties[] = {0.0f, 0.0f, 0.0f, 1.0f};
GLfloat diffuseProperties[] = {1.0f, 1.0f, 1.0f, 1.0f};
GLfloat specularProperties[] = {0.0f,0.0f, 0.0f, 1.0f};
glLightfv( GL_LIGHT1, GL_AMBIENT, ambientProperties);
glLightfv( GL_LIGHT1, GL_DIFFUSE, diffuseProperties);
glLightfv( GL_LIGHT1, GL_SPECULAR, specularProperties);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
The problem is, the brightness of the polygons does not change based on their rotation(normal), but instead changes on the entire object's rotation (the last glRotatef call).
For example I have a small game where you fly a plane, The plane is dark all over until you perform a roll in the X axis. At which point the entire plane becomes white as if it was one big polygon.
The initialization code seems pretty straight forward so I don't see how it could be causing problems, this is why I am confused. Could this problem be deeper in the code?
If you would like any screen shots pleas notify me.
-thanks in advance
I am implementing the light set up like so:
GLfloat lightDir[] = { 0.0, 1.0, 0.0, 0.0};
glLightfv(GL_LIGHT1, GL_POSITION, lightDir);
GLfloat ambientProperties[] = {0.0f, 0.0f, 0.0f, 1.0f};
GLfloat diffuseProperties[] = {1.0f, 1.0f, 1.0f, 1.0f};
GLfloat specularProperties[] = {0.0f,0.0f, 0.0f, 1.0f};
glLightfv( GL_LIGHT1, GL_AMBIENT, ambientProperties);
glLightfv( GL_LIGHT1, GL_DIFFUSE, diffuseProperties);
glLightfv( GL_LIGHT1, GL_SPECULAR, specularProperties);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
The problem is, the brightness of the polygons does not change based on their rotation(normal), but instead changes on the entire object's rotation (the last glRotatef call).
For example I have a small game where you fly a plane, The plane is dark all over until you perform a roll in the X axis. At which point the entire plane becomes white as if it was one big polygon.
The initialization code seems pretty straight forward so I don't see how it could be causing problems, this is why I am confused. Could this problem be deeper in the code?
If you would like any screen shots pleas notify me.
-thanks in advance