# Normals & strip triangles

Hi !
How should I define my table when I want to work with strip triangles with normales when I use glDrawElements ?
With simples triangles are there just 1 normal defined for just 1 vertex, but with strip ones it is much less vertex definied (we don’t should repeating the defiinition for some vertices).
I have really no ideo of how does it works, have someone any example ?
M@o

You have an array of vertices which you pass to glVertexPointer. So, you then must have a corresponding array of normals which you pass to glNormalPointer. Now when you call glDrawElements, the index array will not only pick out the correct vertices, but also the correct normals, assuming that the elements in the normals array are in the same order as the elements in the vertex array.

If you want to know how to calculate the normals, just ask.

Originally posted by cragwolf:
[b]You have an array of vertices which you pass to glVertexPointer. So, you then must have a corresponding array of normals which you pass to glNormalPointer. Now when you call glDrawElements, the index array will not only pick out the correct vertices, but also the correct normals, assuming that the elements in the normals array are in the same order as the elements in the vertex array.

If you want to know how to calculate the normals, just ask.[/b]

Does it works normals array for Triangles strip ? With glDrawElements too ?
How do U make with the average ? (smooth shading it is ?)

M@o

Originally posted by Mao:
Does it works normals array for Triangles strip ? With glDrawElements too ?

Yes.

How do U make with the average ? (smooth shading it is ?)

I assume you already know how to calculate the normal for a triangle. For an array of triangle strips, the normal for a particular vertex can be calculated by averaging the normals for each of the 6 triangles surrounding the vertex. You could do:

normvert := (n1+n2+n3+n4+n5+n6)/6;

But a slightly better method is to weight each of the six surrounding normals by the angle their triangles make at the vertex. You can also preserve some edges if you like, especially if adjacent normals differ by too much.