View Full Version : triangle_strips and normals?
06-07-2001, 06:55 PM
I am learning to use triangle strips to speed things up but one thing I've come accross is how to use normals with them? if i have four vertices that make two triangles where do I put the normals, I would assume there is a different normal for each triangle. Would it be
any suggestions would be appreciated
06-07-2001, 08:40 PM
You can't. If you were using glBegin/glEnd, you could, but vertex arrays do not provide support for one normal per face. You could replicate the normal across the vertices, but then, you would not get very good stripping (if all your faces are facetted, you won't get stripping at all). Your data set will increase as well, because you're adding a lot of redundant data.
06-08-2001, 07:35 AM
OpenGL works in a state machine and on a "per vertex" kind of sense.
Each time you issue a glNormal the current normal is updated. Following glVertex command will take the current normal for calculations.
Your code would work for immediate mode. But the statdard way of doing things is to have a normal per vertex so that lighting togethter with Gouraud shading looks smooth.
To get a faceted look, you simply set glShadeModel(GL_FLAT). OpenGL will then take the last vertex of each sub-primitive (i.e. here the third vertex of each triangle) to calculate the color for that sub-primitve. (The only exception is GL_POLYGON where it's the color of the FIRST vertex. That is because OpenGL has no knowledge about when the last vertex will be issued and it can not remember infinetely many vertices.)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.