How can I dump OpenGL RenderBuffer to PNG or JPG image?

(UIImage *)dumpImage { GLubyte *buffer = (GLubyte *) malloc(backingWidth * backingHeight * 4); GLubyte *buffer2 = (GLubyte *) malloc(backingWidth * backingHeight * 4); GLvoid *pixel_data = nil; glReadPixels(0, 0, backingWidth, backingHeight, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid *)buffer); /* make upside down */ for (int y=0; y.

To finish this thought, you can use UIImagePNGRepresentation or UIImageJPEGRepresentation to get an NSData containing a UIImage encoded as PNG or JPEG. You can then output the NSData anywhere you want on disk (or transmit it or whatever you want), or use UIImageWriteToSavedPhotosAlbum to write directly to the photos album. – Tommy Feb 21 at 12:46 @Tommy, Thanks.

– yeon Feb 21 at 22:23 If speed is your concern, you could flip the image on GPU before reading it. It can be done either by drawing the quad with flipped texture coordinates in Fixed-Function mode or by utilizing a simple shader. – kvark Feb 22 at 12:42 @kvark, Thanks!

– yeon Feb 23 at 20:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions