glMapBuffer is missing from opengl es 2

…衆ロ難τιáo~ 提交于 2019-12-14 02:47:05

问题


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?


回答1:


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.




回答2:


You need extension GL_OES_mapbuffer. This provides glMapBufferOES and glUnmapBufferOES.

There is a separate extension for mapping subranges: GL_EXT_map_buffer_range.




回答3:


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



来源:https://stackoverflow.com/questions/30641095/glmapbuffer-is-missing-from-opengl-es-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!