Reputation: 1673
I have a VBO for vertexes that compose a quad on screen, and I'd like to change it when the programmer requests an image resizing.
It won't be changing frequently, it's only when (and if)
someone requests the image resize, so I don't think I should use GL_STREAM_DRAW
.
The VBO
will also be already loaded when this function is called.
How can I get the VBO
data and change only a few values?
Upvotes: 1
Views: 1906
Reputation: 473192
You can use glBufferSubData
to modify just part of a buffer object. Generally speaking though, you should try to collect all objects that are going to be changing into a single buffer. That way, you can change all of them at once, which will be more efficient. Especially if you use proper streaming techniques.
Having said that:
I have a VBO for vertexes that compose a quad on screen, and I'd like to change it when the programmer requests an image resizing.
You shouldn't need to. Just pass a quad on the range [-1, 1] in X and Y, and don't transform it by a matrix. The quad will effectively be in NDC space, which the system will transform to window space for you. A screen-sized quad does not ever need to change with the size of the screen, so long as you're using glViewport
correctly (which you have to do anyway).
Upvotes: 3