I was sending vertex arrays (of 32 bit floats) to the GPU every time I wanted to draw them, but this wasn't efficient, so I switched to Vertex Buffer Objects to cache my vertex arrays in the GPU.
It's working, but I was wondering if there's a way to determine the size of a given VBO later on without going back to the original vertex arrays? Here's the process I'm struggling with:
I'm probably missing something really obvious. Thanks for any suggestions!
According to the author each batch HAS TO contains an instance of a VBO (plus a VAO) and he insists strongly on the fact that the maximimum size of a VBO is ranged between 1Mo (1000000 bytes) to 4Mo (4000000 bytes).
A vertex buffer object (VBO) is an OpenGL feature that provides methods for uploading vertex data (position, normal vector, color, etc.) to the video device for non-immediate-mode rendering.
A VBO is a buffer of memory which the gpu can access. That's all it is. A VAO is an object that stores vertex bindings. This means that when you call glVertexAttribPointer and friends to describe your vertex format that format information gets stored into the currently bound VAO.
A Vertex Array Object (VAO) is an OpenGL Object that stores all of the state needed to supply vertex data (with one minor exception noted below). It stores the format of the vertex data as well as the Buffer Objects (see below) providing the vertex data arrays.
Doh! Just found it:
int nBufferSize = 0;
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &nBufferSize);
int originalVertexArraySize = ( nBufferSize / sizeof(float) );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With