开发者

How to read from front buffer using glReadPixels?

开发者 https://www.devze.com 2023-03-07 11:33 出处:网络
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 devic

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 frontbu开发者_运维百科ffer. 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?


Switch the reading to the front buffer using

glReadBuffer(GL_FRONT);

0

精彩评论

暂无评论...
验证码 换一张
取 消