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 7 of 7

Thread: Normals and GL_TRIANGLE_STRIP

  1. #1
    Junior Member Regular Contributor
    Join Date
    Sep 2005
    Location
    Dayton
    Posts
    148

    Normals and GL_TRIANGLE_STRIP

    I know how to calculate a normal for polygons. Like if I did glBegin( GL_TRIANGLES ) I would do a glNormal followed by 3 glVertex calls and you repeat this process for each triangle. But I need to draw my triangles as strips so how do I calculate the normals for this since when I add a 4th and each additional pixel after that, I would need a new normal to be calculated? Is this possible? If my question does not make sense, please tell me what confuses you so I can clear up the confusion. Thanks for your help!

  2. #2
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    Re: Normals and GL_TRIANGLE_STRIP

    If you want per face normals you can't use a triangle strip, you'll have to use GL_TRIANGLES.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Sep 2005
    Location
    Dayton
    Posts
    148

    Re: Normals and GL_TRIANGLE_STRIP

    I want normals for lighting and shading. I was reading through some examples in the Superbible and it talked about using normals on a per/polygon basis. Can I do lighting and shading with a normal per/vertex basis? I am plan to do more reading tonight on lighting and shading but any more help would be great. Thanks!

  4. #4
    Intern Contributor
    Join Date
    Apr 2005
    Posts
    98

    Re: Normals and GL_TRIANGLE_STRIP

    You can perform lighting on a per-vertex basis. The normals will be interpolated across the polygon if smooth shading is enabled. Flat shading will eliminate the normal interpolation.

  5. #5
    Junior Member Regular Contributor
    Join Date
    Sep 2005
    Location
    Dayton
    Posts
    148

    Re: Normals and GL_TRIANGLE_STRIP

    So I need to just calculate the normals at the vertices then? And everytime I do a glVertex, right before it do a glNormal? Thanks again!

  6. #6
    Junior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    Slovakia Europe
    Posts
    109

    Re: Normals and GL_TRIANGLE_STRIP

    Originally posted by jtipton:
    You can perform lighting on a per-vertex basis. The normals will be interpolated across the polygon if smooth shading is enabled. Flat shading will eliminate the normal interpolation.
    Normals won't be interpolated across the polygon, only the resulting color, which will be computed per vertex(Normal dot ligtvector). What you mean is per pixel lighting, for this kind of lighting, shaders or some extensions are needed.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,749

    Re: Normals and GL_TRIANGLE_STRIP

    Or you can use 3 times the same normal for each vertex of a polygon.

Posting Permissions

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