View Full Version : Vertex Array Optimization
01-22-2004, 09:15 AM
Could anyone tell me which is the optimal structure for vertex (texcoord, etc) arrays? Should i use separate arays, or one interleaved array. What should be the vertex stride size? I heard something about this. People said vertex data should be n*32bytes. Is this true for interleaved arrays only, or for both structure? Is this important only when data is in client memory, or even if i use VBOs? How should i keep my vertex data be 32bytes? please help!
thanx in advance!
01-23-2004, 07:10 AM
at first, code everything in a simple way. if it's not fast enough, then try to optimize.
which optimization is good, and which one isn't, depends on too much factors.
for example, when using vertex arrays, you can slow the rendering down by converting your mesh from quads to triangles and stripping them. right, you can slow down the whole thing.
imagine the quads were ordered perfectly using the gpu-cache, and the strip ignoring it...
on another hardware, the effect could be the opposite, because of bigger/smaller cache size....
01-23-2004, 08:52 AM
The fewer arrays you use, the better (i e, more interleaving is better). Aligning on 32-byte boundaries and making vertices 32 bytes in size is important for some cards and some versions of DirectX, but less so in OpenGL (although it still certainly can't hurt).
Ideally, interleave such that there's a single stream (full interleave), unless this means you have to touch vertex data freqently; break frequently-touched data out to a second stream, because the size of data touched is going to dominate most algorithms on the CPU.
Don't use InterleavedArrays(); rather, specify each array using VertexPointer(), NormalPointer(), etc.
01-23-2004, 10:50 AM
i dont use interleavedarrays, i use VBOs the way you told. im using one VBO for each array per mesh (one array for vertices, one for normals and one for texcoord). every other configuration proved to be inefficient. if i use one interleaved array fot the mesh data, performance falls about 80%. If concatenate each array in one VBO, i loose 20-30%. btw is it normal that the glDrawArray call takes a lot of time. When i load about a thousand objects, it becomes the bottleneck, and my program spends its most time by waiting for the glDrawArray to finish.
01-26-2004, 12:08 AM
one call, multiple glDrawArrays
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.