Alireza Peer
Alireza Peer

Reputation: 908

Capture what is Rendered in OpenGL

Im Making an android Game with OpenGl ES, I Want to capture what is rendered onto screen By FloatBuffer and save it for later use, For Example If this is the OutPut:

enter image description here

I want this for Result (as PNG Image) :

enter image description here

How can I do this?

Upvotes: 0

Views: 276

Answers (1)

solidpixel
solidpixel

Reputation: 12129

What is on screen won't be a floating point buffer - it's typically RGBA8 unorm 32-bit per pixel.

Capture via glReadPixels to fetch the raw RGBA data - you'll have to supply the raw to PNG save functionality, that's not part of OpenGL ES itself.

Note that this is a relatively expensive operation, especially at high screen resolutions, so don't expect to do this at interactive frame rates.

Upvotes: 2

Related Questions