I can’t find a tutorial or any examples (with source code) of vertex array … and I don’t understand how I can use glTexCoord since I use a index pointer. I can not also use glNormalPointer, is it for normal by face, I need to put a normal by vertex, and why I can’t specify the size of my normal as with glVertexPointer ??
if someone got some answer, anything on that subject, or a URL …
They are simple enough so I can explain them to you here (I hope):
-you specify an array for vertices, an array for normals, an array for texcoords, and whatever else you need.
-arrays must be logically defined so element #n in the vertex array uses normal #n in the normal array and texcoord #n in the texcoord array… So, if you want multiple normals or texcoords for a vertex, you need to specify multiple vertices (with same xyz).
-you must use glEnableClientState for the arrays you need. Generally, the vertex array is on always, and the others are set on or off depending on your needs.
-try to use glDrawElements whenever posible. Its fast!
-glDrawArrays should be fast too, but might not be as flexible as glDrawElements
The rest can be found in the standard OpenGL 1.1 docs (about the function I talked about, etc…).
I’m sorry, but I’ve got another question : can I throw texture coordinate with “old” glTextCoord() whereas I use buffer array for normal and vertex? Because for each vertex, there is only one normal but there are many texture coordinates. And I don’t want to rebuild my vertex and face hierarchy to use vertex array (a triangle with 3 vertex not shared and 3 texture coordinate), as I need shared vertex, to calculate vertex normal, and to animate my mesh (it’s faster to move one vertex shared than many …)
Hello,
I think you should take a look at the Red book, there’s in example code on vertex array
Originally posted by Arath:
[b]hi,
I can’t find a tutorial or any examples (with source code) of vertex array … and I don’t understand how I can use glTexCoord since I use a index pointer. I can not also use glNormalPointer, is it for normal by face, I need to put a normal by vertex, and why I can’t specify the size of my normal as with glVertexPointer ??
if someone got some answer, anything on that subject, or a URL …
I prefer to use glDrawElements and split vertices that have more than one normal, texcoord, etc. But, if all your vertices need multiple texcoords, you’re better with glArrayElement or with inmediate triangles.