Sign in to follow this  
Code-R

MapBufferARB: what are the pros and the cons?

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this