I had GL code working before on a 5.2 Indy. I have just
ported the code to OpenGL without a problem, except for diffuse
and specular lighting. The symptom is that it appears diffuse and
specular lighting is disabled - the object lighting is completely
determined by the ambient light.
I have checked everthing I can think of (BTW, I am running in index
colormap mode because I use only gray scale colors):
and "maplight" examples in the OpenGL programming guide.Quote:> lighting modes and sources are enabled
> material and lighting properties are set - like in the "light"
To make things more interesting, when I ran out of things to check, IQuote:> the normal vector calculations seem fine
tried running the old GL code, which seemed fine before, but it now
has the same problem. I am running on a different machine with 5.3
instead of 5.2. If anyone has any ideas on what could break diffuse
and specular lighting, I would love to hear (see) them.
(some relevant code excerpts are included below)
Thanks for your time,
Gary Whitten
______________________________________________________________________
SETUP LIGHTING:
GLfloat material[] = {1.0, 255.0, 1.0};
GLfloat lightPosition[] = { 1.0, 0.0, 0.0, 0.0 };
GLfloat mat_shininess[] = { 10.0 };
glMaterialfv
(GL_FRONT_AND_BACK, GL_COLOR_INDEXES, material);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
DRAWING:
(for each facet)
glBegin(GL_POLYGON); /*GL: bgnpolygon(); */
for (l=0; l<facet.n; l++)
{
glNormal3fv(n); /*GL: n3f(n); */
/*GL: v3f(vertex.coord)*/
glVertex3fv( (GLfloat *) vertex[l].coord);
}
glEnd(); /*GL: endpolygon(); */