Reputation: 39871
Why glMapBuffer
is missing from opengl es 2.0? Who we can get access to buffer data to change it efficiently? Only glBufferSubData
is the best way to modify the buffer?
Upvotes: 1
Views: 4593
Reputation:
The "best" way to transfer your buffer depends on the data access patterns and the OpenGL driver you are targeting. Here is a great article on choosing between the many options even on OpenGL ES 2.0:
http://hacksoflife.blogspot.com/2013/04/there-must-be-50-ways-to-draw-your.html
Here is a newer article about the similar techniques. It seems that persistent mapping is the state-of-the-art as of OpenGL 4.5:
https://www.opengl.org/wiki/Buffer_Object_Streaming
Lastly, the book "Open GL Insights" has an entire chapter on this issue which is included in the free preview:
http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
Upvotes: 1
Reputation: 10039
glMapBuffer
is an extension in ES 2.0, not part of the core spec. The vast majority of devices (all iOS and most Andriod) offer the extension, but it is not required. The only core way to upload VBO data is with glBufferData
, or glBufferSubData
.
Upvotes: 2
Reputation: 48196
You need extension GL_OES_mapbuffer. This provides glMapBufferOES and glUnmapBufferOES.
There is a separate extension for mapping subranges: GL_EXT_map_buffer_range.
Upvotes: 3