• Create Account

## Normal vectors and triangle strips

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1omri  Members

122
Like
Likes
Like

Posted 30 September 2001 - 11:38 PM

I am trying to light up a large area of triangle strips. For that I need to specify a normal vector for each vertex. I am using glDrawElements() with GL_TRIANGLE_STRIP. I have a vector with the triangle coordinates. As I understand, I can specify only one normal vector for each triangle (for non-smooth results). In that case, how should I create the normal vector? Where should I put the data for it? Should I add it to the coordinate vector? This might be a problem because each vertex is a part of more then one triangle. There are 2 more vertices then triangle in each stripe. How many normals should I use, and in what order? Is it possible to use interleaved arrays in that case? If so how? There is an option of N3F_V3F in the parameters for glIterleavedArray(), but how sould I specify the normals in case I am using triagnle tripes? Thanks

### #2 Anonymous Poster_Anonymous Poster_*   Guests

Likes

Posted 02 October 2001 - 05:27 AM

You provide one normal for each vertex. Smooth shading will interpolate the surface normals across each triangle. I can''t tell you more about how to figure out the surface normals without knowing what kind of surface you''re trying to specify. A hint, though: figure out all the polys that share (or are adjacent to) the vertex and give that vertex the average of the normals of the neighboring polys.

### #3omri  Members

122
Like
Likes
Like

Posted 02 October 2001 - 07:16 PM

I understand how to calculate the normals. My question is more specific: How do I enter the normals to a triangle strip? Which command do I use, in what order should the normals be ordered in order for them to match the correct triangle?

### #4Scarab0  Members

122
Like
Likes
Like

Posted 02 October 2001 - 07:34 PM

Well I don''t know much about interleaved arrays yet. With standard vertex arrays, you specify a glVertexPointer pointing to an array of x,y,z positions for all vertices. And a glNormalPointer pointing to an array of x,y,z normals for all vertices. For texture coordinates, colors, etc, etc you''d pass another pointer. Just make sure to enable each of the arrays you pass to OpenGL using glEnableClientState.

For information how to do this with interleaved arrays, I suggest you try looking in the Red Book: