I have searched the forums but could not find any definitive answer to either of these questions.
#1 VBO Issue.
Is there a maximum size to the buffer data supported by VBOs? And if there is, how are you supposed to find out what the maximum supported by each driver is?
Everything works fine on every ATI based computer I have tried, even large buffer sizes of 256k vertices work fine.
However, it fails on every Nvidia based computer I have tried when I try to use buffers with more than approximately 64k vertices worth of vertex attribute data.
I know for sure that my code and array data is correct.
Also if I render the data as VA’s then it works fine on either platform, other than the performance difference with VAs versus VBOs.
I am generating 2 VBOs, one for the Index array, the second for the vertex attributes (vertex, normal, color) array.
On every Nvidia, as long as the buffer data is 64k vertices or less, then it works fine. As soon as I try to bind buffer data that is more than about 64k vertices, it completely hangs on glDrawElements and doesn’t return back to my code. Because of the hang, I can’t even get an error return to know that the buffer size is too large, making it very difficult to program any error handler for this (stupid Nvidia).
I have tried multiple computers with different Nvidia cards, and multiple different driver versions from 191 to 275, all with the same Nvidia hang results.
What I am doing is basically:
- glGenBuffers at app startup. - allocating and filling the arrays with the index and vertex attribute data. - glBindBuffer and glBufferData on the index array. - glBindBuffer and glBufferData on the vertex attributes array. - glBindBuffer and glVertexPointer, glNormalPointer, glColorPointer with the array interleave offsets. - glBindBuffer and glDrawElements with the index VBO.
I am rendering the entire contents of the index and vertex attributes arrays, no sub array areas are being used or updated.
On Nvidia if the vertex attributes is around 64k vertices or less it works (ie a 256x256 plane), with 148k of vertices it hangs 80% of the time (ie a 384x384 plane), with 256k vertices it always hangs (ie a 512x512 plane).
Am I going to have to split every mesh I deal with into no more than 64k vertices per VBO array set just to get it to work on Nvidia?
And please no comments like “Nvidia is doing it correct and ATI is wrong”.
#2 VBO Question.
Is it necessary to set the glBufferData to a null buffer prior to updating its buffer data on a STREAM or DYNAMIC buffer usage type VBO?
ie, in order to let OpenGL know that the current data can be discarded as new data is coming.
glBufferData(GL_ARRAY_BUFFER, 0, 0, vbo); // tell OpenGL to discard the current data in the VBO -- or is this just an error or wasteful call glBufferData(GL_ARRAY_BUFFER, sizeof_array, array_ptr, vbo); // send the new data
I would assume that OpenGL knows that the buffer usage is not STATIC and that the data can change. So OpenGL should already be expecting to have to discard old data when a new glBufferData data update occurs shouldn’t it?