简体   繁体   中英

OpenGL Updating static VBO

I just tried updating a Vertex Buffer Object (vbo) which has data with static draw in it. Why can I update it with glBufferSubData ? I always thought static vbo's can't be changed.

GL_STATIC_DRAW does not mean that the data can't be changed. The usage parameter of glBufferData is a hint for the underlying implementation and might allow some performance improvements, but it does not constrain the actual usage. The documentation states:

usage is a hint to the GL implementation as to how a buffer object's data store will be accessed. This enables the GL implementation to make more intelligent decisions that may significantly impact buffer object performance. It does not, however, constrain the actual usage of the data store.

Those are just usage hints . The spec explicitly states:

usage is specified as one of nine enumerated values. [description of those nine enum values follow]

usage is provided as a performance hint only. The specified usage value does not constrain the actual usage pattern of the data store.

( OpenGL 4.6 core profile specification , section 6.2 " Creating and Modifying Buffer Object Data Stores", pages 68-69)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM