Ramya Maithreyi
Ramya Maithreyi

Reputation: 507

How to read from front buffer using glReadPixels?

I am using OpenGL ES in Android to render certain images. As soon as i render the frame, I want to take a copy of it. Although I can use FBO for that, only certain devices support FBO. For other devices, I will have to use glReadPixels which consumes more time. Since glReadPixels can copy only the data from back buffer, the buffer can be swapped only after taking a copy which affects the response time for rendering.

Is there any way to copy data from frontbuffer. So that i can render the images to screen as soon as processing is over and take the copy later from front buffer.

EDIT: In some devices the back buffer gets cleared as soon as the buffer is swapped with the front buffer. In some other devices, it is not cleared. I would prefer the image to stay as it is in the backbuffer even after swapping it to front buffer ( rather copying it to front buffer). Is there any way to force the gl not to clear the backbuffer even after swapping?

Upvotes: 2

Views: 2398

Answers (1)

datenwolf
datenwolf

Reputation: 162164

Switch the reading to the front buffer using

glReadBuffer(GL_FRONT);

Upvotes: 1

Related Questions