rlkw1024
rlkw1024

Reputation: 6515

OpenGL VBO usage hints for vertices that animate rarely

Suppose I have a VBO which remains unchanged 95% of the time. But, the other 5% of the time, it's animating. I'm not sure which usage hint to give to OpenGL when calling glBufferData.

On the one hand, it's acting like a GL_STATIC_DRAW buffer 95% of the time. On the other hand, GL_STREAM_DRAW is recommended for animation. Should I just compromise and pass GL_DYNAMIC_DRAW?

Or should I combine them, and call glBufferData with GL_STREAM_DRAW during animation, and then rebuffer with GL_STATIC_DRAW when the animation completes?

Upvotes: 0

Views: 248

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473946

The only viable answer is to try stuff and see what works best for different platforms. OpenGL does not define performance, and every driver will implement these sorts of things differently. The hints are hints; they don't necessarily do anything.

In fact, AMD completely ignores your usage hints; it does what it does based on how you actually use the buffer. That's primarily because too many users of GL used them badly.

Upvotes: 4

Related Questions