PDA

View Full Version : OpenGL coordinate conversion



rednoka
06-19-2009, 02:18 AM
Another problem that I tossed with OpenGL is that: The coordinate system of the OpenGL (0,0 is the bottom left) is not the same with traditional video coordinate system (0,0 top left). If I send my images directly to OpenGL (using glDrawPixels()) the image is shown as up-side down and mirrored. So before displaying it, I need to convert them (using QGLWidget::convertToGLFormat()) but this consumes a lot of CPU cycles.

Instead now I am sending the frame to video card without any conversion as an OpenGL texture. Then by applying OpenGL rotations and transformations, I got the corrected image. This saved %25-30 percent CPU cycles but is it the correct way? Is there simpler and faster solutions?

matchStickMan
06-19-2009, 02:54 AM
you could also do

glScaled( -1.0, -1.0, 1.0 );

That's what I use. It shouldn't be that expensive on the GPU.

IMHO, you are going in a good direction.

dletozeun
06-19-2009, 06:15 AM
you could also do

glScaled( -1.0, -1.0, 1.0 );

That's what I use. It shouldn't be that expensive on the GPU.

IMHO, you are going in a good direction.

That will not work since he does not draw any geometry.
see here (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=259284#Post2592 84)

ZbuffeR
06-19-2009, 08:08 AM
What ? Just draw textured quads, so you can scale/mirror it very easily.

huntc
07-24-2009, 10:19 PM
Use glPixelZoom(1.0, namePBOOrientation);