Jump to content
  • Advertisement
Sign in to follow this  

MapBufferARB: what are the pros and the cons?

This topic is 4609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
PRO: convenient to use.
CON: can be slower than glBufferSubData due to sync issues.

Answer as short as question ;)

If you need more precise information, then ask more precise questions: it mainly depends on how exactly you're using it.

Share this post


Link to post
Share on other sites
MapBuffer can also allow the use of dynamic data without any unnecessary use of memcpy(). BufferSubData requires at least one memcpy.

Ie, MapBuffer, then generate your data directly into the VBO, rather than

myBuffer = malloc(x)
generateData(myBuffer)
glBufferSubData(myBuffer) // memcpy to internal GL storage

But, BufferSubData can be done out-of-line, ie, GL can save your data, and splice it in to the VBO once ongoing rendering is done, without holding up your app. MapBuffer (likely) requires the GL to synchronously flush all usage of that object out of the pipeline, then potentially copy data back to system memory (although if it does this, you're using the wrong storage hint).

They both exist, because there are situations where they each should be used. Neither is universally better.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yann L
PRO: convenient to use.
CON: can be slower than glBufferSubData due to sync issues.

Answer as short as question ;)

If you need more precise information, then ask more precise questions: it mainly depends on how exactly you're using it.


Ahem, yes, you are totally correct about the length thing.
well, I wanted to know if there's any downside to it that'd make me better off using BufferDataARB instead of mapping and writing to the pointer provided? would it be slower?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!