GL_STATIC/DYNAMIC/STREAM_DRAW

Started by
1 comment, last by _the_phantom_ 19 years, 9 months ago
Hey! I've implemented a geoclipmapping engine where I have to update parts of my VBOs maybe every 10th or 11th frame. I'm wondering which specification is best suited for this purpose. I don't have to read from the buffers, which might be important for performance. So which one of the nine possibilities GL_STATIC/DYNAMIC/STREAM_READ/WRITE/DRAW should I use? Is it really relevant for performance? As far as I remember, I didn't get any performance hit when I replaced DYNAMIC (which I had first) by STATIC. Is there any big difference? Could you please explain the main differences? I haven't found much about it in the extension specs. Thanks in advance, Lutz
Advertisement
if there is any difference depends on your driver. if it decides to put everything in video memory, no matter what or the other way round.. well..

anyway, the specs should explain all settings and one should be something like "never read, written to from time to time". so i might go with dynamic_draw or maybe stream_draw. (of course i might be completely wrong because their terminology is slightly confusing)

just pretend static/dynamic/stream means never/sometimes/frequently touched.
f@dzhttp://festini.device-zero.de
they are basicaly useage pattern hints to the driver which can allow it to place the VBO in opterminal memory.

For example, if you declare a VBO as static draw then its free to place it in Vram and leave it there as long as it can safe in the knowleage that you arent going to play with it (although, you still can if you want just expect a hit if you try to read back from a draw or write buffer, writing shouldnt be as bigger issue, just some sync has to be performed).

For the purpose in your post I'd probably go for GL_DYNAMIC_DRAW as you'll be drawing from it more often than anything else although the data is still dynamic. although, you should test with GL_STATIC_DRAW as well.

Also, when updating the VBO try to update large blocks and for the love of god dont use glMap() to do so, its slow and has many sync issues. glBufferSubData() is the prefered method for bits, however you might want to see if using glBufferData() to replace the whole VBO after invalidating it (call to glBufferData with a 0 as the data source) is any faster.

This topic is closed to new replies.

Advertisement