Hello Guest

glBufferDataARB v glMapBufferARB

  • 2 Replies
  • 10361 Views
glBufferDataARB v glMapBufferARB
« on: November 16, 2005, 00:01:59 »
Hi All,

As far as I understand it, both glBufferDataARB and glMapBufferARB provide alternate ways for me to get my vertex, texture coordinates, etc... data into VBO's.

My data is dynamic, i.e. could change every frame. I've been using glBufferDataARB quite well so far, but was wondering if i'm missing out on possible speed gains that glMapBufferARB may provide. From what i've read, i'm not, and infact I can't understand why glMapBufferARB even exists. If anything, it is slower than glBufferDataARB, because you need to make three calls map, put data, unmap as apposed to just one with glBufferDataARB.

I hope someone can enlighten me to the error of my thoughts, or confirm them.

Thanks,
Stephen

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
glBufferDataARB v glMapBufferARB
« Reply #1 on: November 16, 2005, 08:39:01 »
I can't comment on the actual performance difference, but the motivation behind glMapBufferARB is that for truly dynamic data (that is, data generated on the fly at runtime), you can map the buffer and write directly to it, while with glBuffer(Sub)Data, you have to first write the data to a java Buffer, and then copy the contents of it to GL with glBufferData.

 - elias

glBufferDataARB v glMapBufferARB
« Reply #2 on: November 16, 2005, 19:47:22 »
Thanks elias, so in other words it may just save me a bit of memory storage.

I don't want to be recalculating the buffers content each flush to VRAM, as only sections of it my be changing not the whole thing.

I'll stick with glBufferDataARB then as the Sub version of the function is not really any use, becuase the changed sections of the buffer are not necessarily contiguous.

--
Thanks,
Stephen