I found some ways to speed up glReadPixels by OpenGL ES 3.0, but I am not sure if it works or not.
- specifies the fifth argument of glReadPixels() as GL_BGRA to avoid unnecessary swizzle.
- use PBO as this mentioned.
In order to verify, I updated to the latest Android SDK and ADT, and try to use OpenGL ES 3.0. However, I can't find GL_BGRA
definition as I expected, and I don't know how to use glMapBuffer()
. Am I missing something?
To summarize,
- Is there any other faster way to access framebuffer than using glReadPixels() ?
- How to use GL_BGRA and PBO by OpenGL ES 3.0 on Android?
If anyone knows, please point me out. Some code snippets would be better. Thanks in advance.
Not really. I don't know whether you would get performance gains by using BGRA format, but it's worth a try. In ES 2.0, GL_BGRA is only available through extension: EXT_read_format_bgra, so you would need to use the enum GL_BGRA_EXT, and apparently it's the same in OpenGL ES 3.0 too.
Yes, glMapBufferRange is the way to go on OpenGL ES 3.0. It looks like your call is correct, as per your comment. According to spec and man page, glMapBufferRange should not generate GL_INVALID_ENUM errors, so I think something else is wrong here. Make sure the error is not generated by an earlier call.