vertex arrays

F699ebb187331fdf7f7875320e3e7e3e
0
starboarder2001 101 Aug 18, 2003 at 03:49

What is the advantage of using vertex arrays…I know it is speed but “why” is it faster? Right now i am rendering a terrain map. I divide it up into quad trees and render the nodes that are in the view frustrum. I dont have much experience with vertex arrays….so I have a question.

Would I have to have a index array for each node or something? What if there card doesnt support it? I would have to be able to render it with both methods. Main question…would it be worth it to go back and change it to use vertex arrays?

1 Reply

Please log in or register to post a reply.

Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Aug 18, 2003 at 06:20

Generally speaking, vertex arrays are faster because you have less function-call overhead than when calling glVertex3f() many times. With vertex arrays, you just call one function, but with glVertex3f() you call it many times (the number of verticies you have). Index arrays basically lets you share verticies rather than having vertex repitition.

However, vertex arrays or index arrays have nothing to do with hardware support. OpenGL supports them no matter what hardware you use. They are simpily an area in memory where the vertex data is contained.

Another related thing to vertex arrays is vertex buffers(commonly used in DirectX). These are the fastest you can get. But hardware must support it. So it can’t be used if your card doesn’t support it. The main difference between vertex arrays and vertex buffers is that vertex buffers reside in AGP memory rather than main memory (RAM), which makes rendering much faster. OpenGL provides vertex buffers through an extension (ARB_vertex_buffer_object).

If you are concerned about hardware support, than you use vertex arrays or support both.