Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Shininess (or not...)

  1. #1
    Junior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    State College, PA
    Posts
    204

    Shininess (or not...)

    Any suggestions as to why the following code does not give me any shininess?

    Code :
    glEnable(GL_LIGHTING);
      glEnable(GL_LIGHT0);
      GLfloat white_light[] = { 1, 1, 1, 1.0 };
      GLfloat no_light[] = { .1, .1, .1, 1.0 };
      glLightfv(GL_LIGHT0, GL_DIFFUSE, no_light);
      glLightfv(GL_LIGHT0, GL_SPECULAR, white_light);
      glLightfv(GL_LIGHT0, GL_AMBIENT, no_light);
      glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, no_light);
      glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, no_light);
      glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white_light);
      glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 64);
     
      glBegin(GL_TRIANGLES); 
    //yada, yada, yada
    Chris

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,757

    Re: Shininess (or not...)

    Well, I can think of two possibilities. I notice in the code posted, that you haven't set the position of the light. So maybe the light is not where you expect it to be, or maybe you just left that out of the post.
    The other possibility is that your geometry lacks sufficient detail to be lit accurately.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    May 2000
    Location
    Oxford, England
    Posts
    547

    Re: Shininess (or not...)

    set your shininess value lower. The problem here is that when the shininess param is really high, the are very small margins for the specular highlight to appear. The light would have to be exactly positioned at the camera(more or less) for the highlight to appear.

    The other issue is if texturing is enabled also, the highlight will be modulated with the texture colour unless you have seperate specular enabled (geforce & openGL1.2 thing).

    You must be aware when using specular highlights that the highlight is dependant on the shininess param, the colour of the highlight, the position of the light & the position of the camera.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    State College, PA
    Posts
    204

    Re: Shininess (or not...)

    Sorry - I left out a line... the light is at the camera. And the surface is defined quite well (around 20,000 tris). The position of the light is fine, in that everything appears correctly lit from a diffuse source. But no matter what changes I make to the shininess parameters, I get no change in appearance.

    Chris

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,757

    Re: Shininess (or not...)

    That's quite odd, I tested those settings you posted above on a sphere, and it was shiny.

  6. #6
    Junior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    State College, PA
    Posts
    204

    Re: Shininess (or not...)

    ... that's because I'm stupid.

    My normals were getting messed up soemwhere along the line... I fixed that, and voila! shininess. Thanks for your help...

    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •