PDA

View Full Version : Vertex Array Issue??



dabeav
05-10-2002, 04:06 AM
Ok I want to use both, an indexed normal array, and an indexed interleaved texture coord/vertex array. Both arrays will pertain to the same object. Is it possible to draw this this way?? I know I would have to use glDrawElements(etc); but how would I display BOTH arrays?? Or should I simply break the interleaved array up into 2 seperate arrays?? The reason I have done things this way so far is this. I want to use face normals for each triangle, not the vertex normals, I am making alot of squares, that I want to remain square, so using face normals is best. But will what I asked work?? Thanks in advance.

mproso
05-12-2002, 12:01 PM
Hello,
both arrays must have same indexes if you are going to use glDrawElements.
If glShadeModel(GL_FLAT) is no good for you, you can rearrange your data
because every vertex can have more than one normal. For example cube, there
are eight vertices but only six normals. Im not 100% sure but for arrays you
must have same number of vertices and normals so for cube example every vertex
have three normals because every vertex is shared between three faces of cube.
For our cube normal array would have 8*3 elements and vertex array would have
same number of elements but with only 8 different vertices that repeat inside array.
Sorry, it is little hard for me to explain in english
but I hope this can be of some help.

Robbo
05-13-2002, 03:56 AM
Cube has eight normals, one on each corner (vertex normals are used for lighting, which are `averaged' surface normals). If you are not wanting to use Vertex normals, then I can assume you are not wanting to light your polygons `correctly'. In this case, vertices will be shared but normals won't. However, you cannot specify a seperate normal index array to your vertex index array. You specify only one index set for all arrays, but those arrays can be different.

In my opinion, using flat shading would be a better idea.