Imagination PowerVR SDK Blog

glReadPixels alternative?



i’ve developed an application (for omap3530) that uses texture streaming extension to “upload” video frames (720x625 UYVY) to sgx, applies a fragment shader and renders to a FBO. With this setup it can handle the incoming 25 fps video stream with a rendering time of about 1ms.

As others have pointed out in this forum, the problem is when trying to read back processed video frames with glReadPixels. With my setup it gets about 150ms for every glReadPixels call.

Is there an  alternative way to get data “out” that doesn’t kill performance?



Hi Enrico,

There isn’t a generic alternative to glReadPixels(). There may be a platform/OS specific way of reading databack from the GPU more optimally. An example of this is when an OS allows an application to retrieve a CPU handle to an EGLImage surface. The application can then have the CPU accessing one EGLImage surface while the GPU writes to another. If it is possible to implement something like this on your target platform, you will also need to implement a locking mechanism to prevent the CPU and GPU accessing the same surface at the same time.


Hi Joe,

basically what i need will be to:

- create an eglImage with eglCreateImageKHR using a native pixmap or texture (EGL_NATIVE_PIXMAP_KHR or EGL_GL_TEXTURE_2D_KHR)

- bind it to a texture (with glEGLImageTargetTexture2D ?)

- use this texture as a color attachment in a FBO

- read from the native pixmap pointer when the gpu is not rendering.

Is this correct?

With TI OMAP on linux the NativePixmap should be supported and the EGL image extensions are present so every bit should be there.