PDA

View Full Version : One Vertex Array or Multiple Vertex Arrays ?



11-24-2003, 06:05 AM
Hi there!

Just wanted to know if this is a good way to draw many objects onto the screen, which are stored in different arrays:




glInterleavedArrays(GL_V3F, 0, ArrayNr1);
glDrawArrays(GL_POLYGONS, 0, 12);

glInterleavedArrays(GL_V3F, 0, ArrayNr2);
glDrawArrays(GL_POLYGONS, 0, 24);


I want to load vertice-data dynamically in my programm, so its nearly impossible to save the data in one static array. Or did I oversee another possible solution? Should I preload all my meshes at the beginning of the program into a big static array (although i maybe dont need half of it)?

Maybe an experienced opengl-specialist could give me some advice how to handle this.
Thx for any hints!

11-24-2003, 09:16 AM
Nevermind, i read some threads about display lists and will try to draw objects that way. http://www.opengl.org/discussion_boards/ubb/smile.gif



Display lists
Can encapsulate data in the most efficient manner for hardware, though they are immutable (i.e. once created, you can't alter them in any way)

DrawElements/DrawArrays Using wglAllocateMemoryNV(size,0,0,1)
Saves data in video memory, eliminating any bus bottleneck. Very poor read/write access.

DrawElements/DrawArrays Using wglAllocateMemoryNV(size,0,0,.5)
Saves data in AGP (uncached) memory, and allows hardware to pull it directly. Very poor read access, must write sequentially.

DrawElements using Compiled Vertex Arrays (glLockArraysEXT)
Copies locked vertices to AGP memory, so that the hardware can pull it directly. Only certain modes are supported. (t2f/t2f/c4ub/v3f)

Immediate Mode
Multiple function calls required per primitive results in relatively poor performance compared to other options above.

All Other Vertex Arrays
Must be copied from application memory to AGP memory before the hardware can pull it. Since data can change between data calls, data must be copied every time, which is expensive.