VBO Doubts
I have some VBO doubts, hope some caring soul will answer them [wink]
- How do I detect the memory on the card, and its usage, so that I can better manage my usage of it, and prevent my engine from overflowing the card with too much textures/meshes.
- Can I lock/unlock a gemotry chunk on the gpu's ram, so that it knows im not going to alter it?
- Can VBOs be used on other things than meshes, like textures?
- Can I get information on a buffer object, to determine if it is in Client/Server Ram?
- Can I use Triangle Strips with VBOs, and is there a performance gain on more recent cards? (9600 and above... I've heard some cards prefer raw vertex information)
- When using indices with a VBO, should I use unsigned integers or unsigned shorts (4 bytes vs 2 bytes)?
I'll post more as it occurs to me, I'm planning on having a firm grasp on this subject, as I intend to write a tutorial on it later on.
Thanks for any replies.
- You cant
- Dont map it, its automagicaly unlocked that way, it only becomes 'locked' when you either (a) map it (and really, dont) or (b) perform an update, at which point locking/unlocking and sync is handled by the driver
- VBOs, no, however there is a Pixel Buffer Object (PBO) extension which extends VBOs to work with pixel buffers as well
- Not afaik
- You can use strips, raw triangles, lists, whatever you like, its just a vertex array in video ram. What do you mean by 'raw vertex infomation' ?
- unsigned shorts are better, small and take up less tranfer bandwidth. While you gain a huge range with ints most of it will be wasted
Hope that was some help [smile]
- Dont map it, its automagicaly unlocked that way, it only becomes 'locked' when you either (a) map it (and really, dont) or (b) perform an update, at which point locking/unlocking and sync is handled by the driver
- VBOs, no, however there is a Pixel Buffer Object (PBO) extension which extends VBOs to work with pixel buffers as well
- Not afaik
- You can use strips, raw triangles, lists, whatever you like, its just a vertex array in video ram. What do you mean by 'raw vertex infomation' ?
- unsigned shorts are better, small and take up less tranfer bandwidth. While you gain a huge range with ints most of it will be wasted
Hope that was some help [smile]
Quote:Original post by Prozak
I have some VBO doubts, hope some caring soul will answer them [wink]
- How do I detect the memory on the card, and its usage, so that I can better manage my usage of it, and prevent my engine from overflowing the card with too much textures/meshes.
- Can I lock/unlock a gemotry chunk on the gpu's ram, so that it knows im not going to alter it?
- Can VBOs be used on other things than meshes, like textures?
- Can I get information on a buffer object, to determine if it is in Client/Server Ram?
- Can I use Triangle Strips with VBOs, and is there a performance gain on more recent cards? (9600 and above... I've heard some cards prefer raw vertex information)
- When using indices with a VBO, should I use unsigned integers or unsigned shorts (4 bytes vs 2 bytes)?
I'll post more as it occurs to me, I'm planning on having a firm grasp on this subject, as I intend to write a tutorial on it later on.
Thanks for any replies.
Your textures are already stored in VRAM no need for VBOs and textures...
Yes you can use Triangle strips with VBOS
Use whatever you need to use for the application for data types, I use floats
About the indices thing, dont quote me on this, but i was pretty sure that there was a huge performance hit when using unsigned bytes, and since unsigned shorts arent big enough for the card's memory alignment either, i figure that it would "offer" a performance hit as well...
-Dan
edit: and the bandwidth wont be a problem if your only uploading your indices once anyways
-Dan
edit: and the bandwidth wont be a problem if your only uploading your indices once anyways
16bit indices are prefered over 32bit ones, see performance pdf in my sig above.
and while it might not be a problem on small apps once things start to mount up and wasting half your bandwidth on zeros isnt very productive.
There might well be times when you'll need to send over 65K verts at once, but most of the time keeping to 16bit indicies is much better.
and while it might not be a problem on small apps once things start to mount up and wasting half your bandwidth on zeros isnt very productive.
There might well be times when you'll need to send over 65K verts at once, but most of the time keeping to 16bit indicies is much better.
Thanks phantom, using UShorts has already bumped up my framerate 17% [wink]
If i wanted to map (this means "lock" right?) a VBO, what functions should i be using?
Again, thanks for the replies.
If i wanted to map (this means "lock" right?) a VBO, what functions should i be using?
Again, thanks for the replies.
Quote:Original post by Prozak
If i wanted to map (this means "lock" right?) a VBO, what functions should i be using?
glMapBuffer [lol]
It's called glMapBufferARB if you're using the extension version -- it was absorbed into the standard for 1.5.
Thanks Promit. [1] Can you tell me what parameters glMapBuffer takes?
Now, another thing I have in my code is that I define Vertices, Normals and Texture Coordinates with
glBindBufferARB( GL_ARRAY_BUFFER_ARB, handle );
and face indexes with
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, handle);
[2]Is that correct? [3]And why do we use diferent keywords for both?
Another thing I noticed in my code:
glDrawElements(GL_TRIANGLES, numberVertices, GL_UNSIGNED_SHORT, 0);
[4]Why do I, in the second parameter, have to define the number of vertices, if i'm working with an indexed mesh? Should'nt I be passing the number of faces instead? Or is there another call to actually render the mesh as indexed, and not as a list of vertices?
Again, thank you for your patiente and replies [wink]
Now, another thing I have in my code is that I define Vertices, Normals and Texture Coordinates with
glBindBufferARB( GL_ARRAY_BUFFER_ARB, handle );
and face indexes with
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, handle);
[2]Is that correct? [3]And why do we use diferent keywords for both?
Another thing I noticed in my code:
glDrawElements(GL_TRIANGLES, numberVertices, GL_UNSIGNED_SHORT, 0);
[4]Why do I, in the second parameter, have to define the number of vertices, if i'm working with an indexed mesh? Should'nt I be passing the number of faces instead? Or is there another call to actually render the mesh as indexed, and not as a list of vertices?
Again, thank you for your patiente and replies [wink]
Quote:Original post by Prozak
Can you tell me what parameters glMapBuffer takes?
Normally I'd shoot this down with a Google/MSDN link...but it's amazing how badly documented the VBO extensions are, given their importance. So I'll write documentation, just for you.
GLvoid* glMapBufferARB( GLenum target, GLenum access );
Returns a pointer to the locked buffer. Target specifies the type of buffer; the possible values are the same as used with glBindBufferARB. access specifies the desired access privileges to the buffer. Valid values are GL_READ_WRITE, GL_READ_ONLY, and GL_WRITE_ONLY.
Quote:Original post by Prozak
Now, another thing I have in my code is that I define Vertices, Normals and Texture Coordinates with
glBindBufferARB( GL_ARRAY_BUFFER_ARB, handle );
and face indexes with
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, handle);
[2]Is that correct?
Yep.
Quote:Original post by Prozak
[3]And why do we use diferent keywords for both?
Buffers bound to ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER are used for by different functions. Without it you could do something like bind an index buffer and then call VertexPointer, which is obviously wrong. Of course, you can still bind that index buffer to ARRAY_BUFFER but this way provides more separation between the two.
Quote:Original post by Prozak
Another thing I noticed in my code:
glDrawElements(GL_TRIANGLES, numberVertices, GL_UNSIGNED_SHORT, 0);
[4]Why do I, in the second parameter, have to define the number of vertices, if i'm working with an indexed mesh? Should'nt I be passing the number of faces instead? Or is there another call to actually render the mesh as indexed, and not as a list of vertices?
glDrawElements renders indexed vertices, glDrawArray renders non-indexed vertices. You should be specifying the number of indices in the second parameter, not the number of vertices. Having said that, with index buffers where each vertex is only referred to once the numbers are the same.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement