Skip to main content
GameDev.net gamedev.net
🔒 Locked

Append data to dynamic VBOs

Started by c0der_ Feb 18, 2011 at 5:04 AM 3 replies 2.3k views
Original Post
c0der_
c0der_
How do you append data to dynamic VBOS during rendering? I don't want to render the buffer if there are too little vertices.
glBufferDataARB(GL_ARRAY_BUFFER_ARB, m_pDynamicBuffers[m_nDynamicBufferIndex].nBufferSize, pVertices, GL_DYNAMIC_COPY);

Does GL_DYNAMIC_COPY append the data or overwrite? Or perhaps I just need to store the data, append the data, and pass it into glbufferdata again with the new data, any thoughts?

karwosts
karwosts
Use glBufferSubData, doesn't require you to overwrite the whole buffer. You can't make a buffer any larger, but you can overwrite parts of it. If you need to resize it you call glBufferData again.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
c0der_
c0der_
so I just create the buffer with the initial vertices and overwrite parts of it in each render call? isn't it better to just create separate static buffers rather than overwriting parts of a dynamic buffer?


Use glBufferSubData, doesn't require you to overwrite the whole buffer. You can't make a buffer any larger, but you can overwrite parts of it. If you need to resize it you call glBufferData again.
karwosts
karwosts
isn't it better to just create separate static buffers rather than overwriting parts of a dynamic buffer?[/quote]

All depends what you're trying to do.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.