View Full Version : glReadPixels - any possibility to flip image by OpenGL?
I am using glReadPixels in order to copy the content of the frame buffer to an image. Of course, the image is in a bottom-up format, but I'd like to have it in a top-down format. Is there any way to tell OpenGL that it should copy the image flipped, or do I have to do it myself? glZoom does not seem to applay for glReadPixels.
04-28-2004, 03:15 AM
can't you just flip the image on the way to disk?
As far as I know, there's no way to flip an image in place using the gl. You might try using a projection matrix flip when you draw the image.
But you might consider doing it manually anyway, as it's a nice feature to have in your image library.
There is a round about way to do this after all:
// copy starts at lower left corner of screen
// flip the y direction
// copy in place
glCopyPixels( 0, 0, width, height, GL_COLOR );
then you would call ReadPixels().
of course I can do it myself, but I have written a generic image class for multiple purposes (which is in a top-down format), and the idea was to keep everything as simple and fast as possible - but it seems that I don't have any luck with glReadPixels for a generic approach. Your idea with OpenGL flipping the framebuffer is neat, but the pixel-copy operation shouldn't have any side-effects on the framebuffer - flipping twice would be a solution, but things are getting really expensive.
Guess I have to flip it myself or add support for bottom-up images in my lib.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.