mhagain
08-01-2010, 06:21 PM
First a little introduction. I know and use both OpenGL and D3D, but most of my recent experience has been with D3D. I've successfully implemented dynamic VBOs in D3D (D3DUSAGE_DYNAMIC, D3DLOCK_DISCARD) and have recieved a very significant performance boost as a result.
Now onto the problem. I'm trying to do the same with OpenGL and it's just not working out. All drawing is going through a single glDrawElements call (using 16-bit indexes), state changes are buffered up and then replayed, everything is batched up as agressively as possible, and there are a total of about 11 glDrawElements calls happpening. One index buffer, one vertex buffer (but see below).
Tactics I've tried so far include both glMapBuffer and glBufferSubData, with the latter run both many times per frame (per polygon, basically) and once only just before drawing. Variations of GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW, glMapBuffer both with and without a glBufferData (... NULL ...) call, benchmarked on light scenes, heavy scenes, light CPU load, heavy CPU load, single buffering, double buffering, quadruple buffering, you name it, I've tried it.
There is zero performance difference between dynamic VBOs and regular vertex arrays in everything I've tried.
Before I write dynamic VBOs in OpenGL off as a "non-feature", I'm interested in knowing if there is any such animal as a definitive "this is how you do dynamic VBOs in OpenGL" thing?
Thanks.
Now onto the problem. I'm trying to do the same with OpenGL and it's just not working out. All drawing is going through a single glDrawElements call (using 16-bit indexes), state changes are buffered up and then replayed, everything is batched up as agressively as possible, and there are a total of about 11 glDrawElements calls happpening. One index buffer, one vertex buffer (but see below).
Tactics I've tried so far include both glMapBuffer and glBufferSubData, with the latter run both many times per frame (per polygon, basically) and once only just before drawing. Variations of GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW, glMapBuffer both with and without a glBufferData (... NULL ...) call, benchmarked on light scenes, heavy scenes, light CPU load, heavy CPU load, single buffering, double buffering, quadruple buffering, you name it, I've tried it.
There is zero performance difference between dynamic VBOs and regular vertex arrays in everything I've tried.
Before I write dynamic VBOs in OpenGL off as a "non-feature", I'm interested in knowing if there is any such animal as a definitive "this is how you do dynamic VBOs in OpenGL" thing?
Thanks.