Diffuse and Specular Lighting seems broken

Diffuse and Specular Lighting seems broken

Post by Gary Whitt » Sat, 18 May 1996 04:00:00



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):

Quote:> lighting modes and sources are enabled
> material and lighting properties are set - like in the "light"

  and "maplight" examples in the OpenGL programming guide.

Quote:> the normal vector calculations seem fine

To make things more interesting, when I ran out of things to check, I
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(); */

 
 
 

Diffuse and Specular Lighting seems broken

Post by Chris Frazi » Sun, 19 May 1996 04:00:00


|> Organization: Clark Internet Services, Inc.
|> NNTP-Posting-Host: 198.17.243.76
|> Mime-Version: 1.0
|> Content-Type: TEXT/PLAIN; charset=ISO-8859-1
|> Content-Transfer-Encoding: 8bit
|> X-Newsreader: TIN [version 1.2 PL2]
|>
|> 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):
|> > lighting modes and sources are enabled
|> > material and lighting properties are set - like in the "light"
|>   and "maplight" examples in the OpenGL programming guide.
|> > the normal vector calculations seem fine
|>
|> To make things more interesting, when I ran out of things to check, I
|> 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(); */
|>
|>

is GL_NORMALIZE enabled?

ChrisF

|>
|>
|>
|>

 
 
 

1. Diffuse and Specular Lighting seems broken

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.

To make things more interesting, when I ran out of things to check, I
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(); */

2. How do I stretch a line?

3. Why seperate colors for diffuse and specular light?

4. Way off topic: Puerile "special-person" spruiker and the coffee stain

5. Diffuse and Specular Shading

6. fBm as a DSO

7. separate specular, diffuse

8. Intel's Image Processing Library

9. diffuse and specular map

10. Pong lightning, computing the specular & diffuse-component

11. diffuse and specular

12. 7.5b breaks diffuse procedurals