in mujoco_py/gl/eglshim.c [206:227]
void readPBO(unsigned char *buffer_rgb, unsigned short *buffer_depth,
unsigned int pbo_rgb, unsigned int pbo_depth,
int width, int height, int batchSize)
{
if (pbo_rgb > 0) {
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, pbo_rgb);
GLubyte* src_rgb = (GLubyte*) glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
memcpy(buffer_rgb, src_rgb, batchSize * width * height * 3);
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB);
}
if (pbo_depth > 0) {
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, pbo_depth);
GLushort* src_depth = (GLushort*) glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
memcpy(buffer_depth, src_depth, batchSize * width * height * sizeof(GLushort));
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB);
}
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0);
}