PDA

View Full Version : glDrawElements & noramls



Ronen
08-17-2001, 03:20 AM
hi !!
I read http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/000755.html .
I have the same problem - I am rendering very big meshed (more the n50,000 triangles) , and I am using the gldrawelements funvtion.
My problem is with the normals : I am rendering the mesh while the user can rotate it .
I did that normal copying as suggested but - it always seems the light rotates with the mesh (using glBegin(glTriangles) - gives me the required result - so it is the drawelements problem).
Here is a mesh I use for debug (a cube )
8 - num of vertices , 12 - num of triangles.
first I write the 8 vertices (3d) , then the triangles , and last the normals (as offeref 3 copies -one per each vertex of the triangle).
8 12

-2 -2 -2
2 -2 -2
2 2 -2
-2 2 -2
-2 -2 2
2 -2 2
2 2 2
-2 2 2

0 2 1
0 3 2
0 1 5
0 5 4
1 2 6
1 6 5
3 6 2
3 7 6
0 4 3
3 4 7
4 5 6
4 6 7

0 0 -1 0 0 -1 0 0 -1
0 0 -1 0 0 -1 0 0 -1
0 -1 0 0 -1 0 0 -1 0
0 -1 0 0 -1 0 0 -1 0
1 0 0 1 0 0 1 0 0
1 0 0 1 0 0 1 0 0
0 1 0 0 1 0 0 1 0
0 1 0 0 1 0 0 1 0
-1 0 0 -1 0 0 -1 0 0
-1 0 0 -1 0 0 -1 0 0
0 0 1 0 0 1 0 0 1
0 0 1 0 0 1 0 0 1