Archived

This topic is now archived and is closed to further replies.

LizardCPP

VBO:s and matrix stack

Recommended Posts

Ok I'm playing around with vbo:s and I have a couple of questions. 1. If I have one vbo and two (or more) arrays with verticies can I put them in the vbo after each other, if so how? 2. If the (1) works, then if the two verteicies arrays have to be renderer with diffrent modelview matricies, can that be done? I mean can they then be put in the vbo after each other and then the call to glDrawArrys(..). LizardCPP edit 3. Also, can the two verticies arrays be of diffrent type, one may have a GL_C4UB_V3F and another GL_C3F_V3F [edited by - LizardCPP on January 15, 2004 12:43:12 PM]

Share this post


Link to post
Share on other sites
You can''t really add more data to an existing buffer object. If you really want to add more data you''ll have to create a new buffer object with all the data you want in it. To render each array with separate modelview matrices you have to call glDrawArrays multiple times with the start index set to the start of each array and set the count to the number of vertices in that array.

The vertices can be of a different type, if you wish, but you''ll have to call the gl*Pointer or glInterleavedArray functions for each array. In this case you''ll also have to calculate the correct offset to determine where each array starts in the buffer. You''ll then call glDrawArrays with the start index set to zero.

It might be better to simply put each array in a separate buffer. If the arrays are all of the same format then it''s not so bad to put them in a single buffer, but if they are of different formats you gain extremely little in terms of performance, but alot in terms of complexity of implementation.

Share this post


Link to post
Share on other sites
Mapping a vertex buffer allow you to write or read directly from a vertex buffer. AFAIK, you cannot change the size of the buffer; you can only change the data. It can be costly in terms of performance, but is a good option if you are going to occasionally change the data in the buffer.

Share this post


Link to post
Share on other sites