I am using OpenGL ES 2.0, but I think it is also relevant to non-ES: how to know what "usage" to choose when creating a VBO?
This particular VBO will be used for 1 to 4 times before completely updated, and I am not sure if I must pick GL_STREAM_DRAW or GL_DYNAMIC_DRAW.
GL_DYNAMIC_DRAW is used if you are going to change buffer partially, for example with glBufferSubData() .
GL_STATIC_DRAW. The data store contents will be modified once and used many times as the source for GL drawing commands. GL_DYNAMIC_DRAW. The data store contents will be modified repeatedly and used many times as the source for GL drawing commands.
Description. glBufferData creates a new data store for the buffer object currently bound to target . Any pre-existing data store is deleted. The new data store is created with the specified size in bytes and usage . If data is not NULL , the data store is initialized with data from this pointer.
Well, according to the OpenGL API you should use DYNAMIC_DRAW.
STREAM
You should use STREAM_DRAW when the data store contents will be modified once and used at most a few times.
STATIC
Use STATIC_DRAW when the data store contents will be modified once and used many times.
DYNAMIC
Use DYNAMIC_DRAW when the data store contents will be modified repeatedly and used many times.
Make sure to update the VBO with glBufferSubData()
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