Is it possible to read back content of VBO in OpenGL ES 2.0 ? I have tried glMapBufferOES, but there is no READ flag.

I dont want any answers, like "you shouldnt do it" or "keep copy of geometry in ram".


3 Answers 3


I have used glMapBufferRange EXT (on iOS it should be supported on all types of devices), instead of glMapBufferOES / glUnMapBufferOES with READ flag, and its working correctly

glBindBuffer( GL_ARRAY_BUFFER, buffer );
void * data = glMapBufferRange(GL_ARRAY_BUFFER, 0, vboSize, GL_MAP_READ_BIT);

//do someething with data

glBindBuffer( GL_ARRAY_BUFFER, 0 );

Regarding OpenGL ES glMapBufferOES is not part of the standard OpenGL ES but is actually an extension, regardless, it seems you can't use GL_READ_ONLY_OES the only defined tokens according to the extension registry are

/* GL_OES_mapbuffer */
#ifndef GL_OES_mapbuffer
#define GL_WRITE_ONLY_OES                                       0x88B9
#define GL_BUFFER_ACCESS_OES                                    0x88BB
#define GL_BUFFER_MAPPED_OES                                    0x88BC
#define GL_BUFFER_MAP_POINTER_OES                               0x88BD

It seems you can only use GL_WRITE_ONLY_OES, I suspect that you can memcpy returned pointer (since naturally speaking writing on a memory location require reading it first from a computer architecture point of view). This is only a speculation I didn't test it nor I guarantee it to work. for example in semi-pseudo code:

for (int i = 0; i < count; i++) {
    memcpy( yourBuffer, vbo, 4*sizeof(GLfloat));
  • \$\begingroup\$ Yes.. but glMapBufferOES(GL_ARRAY_BUFFER, GL_READ_ONLY) can not be done, because GL_READ_ONLY does not exest \$\endgroup\$ Commented Nov 3, 2013 at 10:30
  • \$\begingroup\$ I edited the answer \$\endgroup\$
    – concept3d
    Commented Nov 3, 2013 at 11:17
  • \$\begingroup\$ Interesting idea.. only problem is, that glMapBufferOES returns NULL pointer and if check error, I got GL_INVALID_OPERATION :( Even for writing \$\endgroup\$ Commented Nov 3, 2013 at 17:20
  • \$\begingroup\$ @MartinPerry I think it's platform dependent, but I think this simply means you can't use glMapBufferOES on your specific platform. \$\endgroup\$
    – concept3d
    Commented Nov 4, 2013 at 9:30
  • 1
    \$\begingroup\$ well I think you are misusing the function especially because your are getting an error check this stackoverflow.com/questions/13298123/… \$\endgroup\$
    – concept3d
    Commented Nov 4, 2013 at 10:44

I dont want any answers, like "you shouldnt do it" or "keep copy of geometry in ram".

You're going to be disappointed then because the GL ES specification and documentation don't define any way of reading back: http://www.khronos.org/opengles/sdk/docs/man/

At this stage you need to consider why you want to do such a readback; reading back from GPU memory is a slow operation, and if you really must do it, you may be better off just not using buffer objects at all (which is allowed by ES2).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .