View Full Version : VBO and indexed tris
09-29-2003, 11:43 AM
I am implementiong VBOs into my project. I have the vertices, texcoords, ... stored in arrays, but do i have to sort them, so that vertex corresponds to texccord and normal or can i use an index buffer ? I would have to duplicate some vertices if i have to sort them, but i would not need the indexbuffer.
How should i do that ? indexed or not ? what's faster ?
09-30-2003, 04:36 AM
Not one who can help ? Or don't you understand my Problem ?
[This message has been edited by Tom78 (edited 09-30-2003).]
09-30-2003, 11:50 AM
I'm not sure what's your problem here.
If you mean that you want to use vertex with texcoord then no it's definately not possible. You can not have multiple index buffers, say one for vertices and one for texcoords.
Though, you can have multiple vertex buffers objects, say one VBO for vertex data and another VBO for texcoords. But both have to be ordered the same way, so that a single index array can refer to them.
09-30-2003, 12:44 PM
Yes of course, but is it faster to use indexbuffers or to sort the vertex/textcoord/normal arrays so that you don't need indexes, because there is always one vert/texcoord/normal. In this case the index buffer would be :
1/1/1 2/2/2 3/3/3 4/4/4 ... n/n/n
and would not be needed. Is that faster than with indexes ?
09-30-2003, 02:43 PM
Unless vertices are all different (for instance if triangles never touch each other) then it's always faster to use indices, for two main reasons : memory saving and vertex caching. I think that memory saving is pretty obvious, especially if you store the index array in the software side. Vertex caching is a bit more complex but not so much : thanks to indices, it's easy to recognize when the same vertex is sent twice to the graphics card, thus every computation related to that vertex (lighting, texgen, fog, etc) will not be computed twice : it will be computed once, stored in a cache and reused when the same index is invoked again in the future. Well, in fact it can be computed twice if the vertex cache is not big enough but that's another problem. Keep in mind that vertex caching is done automatically by the driver and hardware, so it's always hard to fully optimize your code for it, but anyway what's sure is that if you don't you indices you will never benefit the vertex caching feature.
[This message has been edited by vincoof (edited 09-30-2003).]
09-30-2003, 03:41 PM
Thank you vincoof, that was what i needed to hear.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.