# The Industry's Foundation for High Performance Graphics

1. ## 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. ## 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. ## 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. ## 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. ## 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. ## 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. ## Re: Normals and GL_TRIANGLE_STRIP

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

8. ## Re: Normals and GL_TRIANGLE_STRIP

Sorry about the typo from my previous post. My recommendation stays the same however. Per-pixel lighting is not what Todd is looking for.

9. ## Re: Normals and GL_TRIANGLE_STRIP

OpenGL is a state machine, which means, that any variable stays the same until you modify it. That means, that you could set the normal one time and then draw thousands of quads/triangles/whatever all with the same normal when you never call glNormal again.
On the opposite side you also could change the normal for a triangle three times, so that every vertex has it's own normal vector.
At triangle strips you can only apply one normal to one vertex, which means, that up to three triangles share one normal for their common vertex.
For spheres it's no problem, but a cube can't be rendered this way.

#### Posting Permissions

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