OpenGL 更新静态 VBO

OpenGL Updating static VBO

我刚刚尝试更新一个顶点缓冲区对象 (vbo),其中包含带有静态绘制的数据。为什么我可以用 glBufferSubData 更新它?我一直以为静态vbo是不能改变的。

GL_STATIC_DRAW不代表数据不能改。 glBufferDatausage 参数是对底层实现的提示,可能允许一些性能改进,但它不限制实际使用。 documentation 状态:

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.

这些只是用法提示。规范明确指出:

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,第 6.2 节“创建和修改缓冲区对象数据存储”,第 68-69 页)