View Full Version : normals for triangle strips.
03-25-2003, 02:22 PM
where do you specify normals when drawing triangle strips? what i mean is that with 4 verticies i draw 2 triangles having (potentially) 2 different normals. if i have 4 calls to glVertex(), at what point do i specify the normal of the second triangle.
glNormal( .... ); // normal of first triangle
glVertex( ... ); // vertex 1
glVertex( ... ); // vertex 2
glVertex( ... ); // vertex 3
glVertex( ... ); // vertex 4
vertices 1,2,3 make up a triangle with one normal and 2,3,4 are a triangle with a different normal. at which line can i call glNormal() to specify the second normal so that both triangles have their own distinct normal??
03-25-2003, 02:31 PM
Well you can get around this either by adding a repeated normal for the first vertex you call, or you can make your first normal call after the first vertex call.
03-26-2003, 12:17 AM
Specify the normal just before the third vertex of each triangle.
03-26-2003, 12:49 AM
Specifying the normal before each third vertex of each triangle will only work for shademodel GL_FLAT.
Refer to OpenGL RedBook Chapter 4: Color, Table 4-2 which vertex is used to specify the flat shaded color for each primitive. Well it's simply always the last vertex of an individual sub-primitive, except for polygons where it's the very first vertex.
For Gouraud shading the correct answer is, always specify the normal before the vertex at which the normal has changed state.
If you want Gouraud shading with face normals, this is not possible with a triangle strip, as each vertex can only have one normal, use independent triangles then and specify the face normal before each triangle.
As triangle strips add a new triangle with each vertex after the second one, you need to specify one normal per vertex anyway if it changes, not much to save here for long strips.
For vertex arrays this is also imperative, as arrays need to have the same number of state entries.
[This message has been edited by Relic (edited 03-26-2003).]
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.