View Full Version : vertically mirror screen?
02-07-2008, 05:29 PM
How do I horizontally mirror the rendering output of OpenGL (i.e. flip left and right around the vertical through the center of the screen)? glScalef (-1.0, 1.0, 1.0) doesn't do the trick.
02-07-2008, 08:12 PM
glViewport(0, w, 0, h)
glViewport(w, 0, 0, h)
02-07-2008, 08:31 PM
void glViewport( GLint x, GLint y, GLsizei width, GLsizei height )
(0, w, 0, h) would have to be (0, 0, w, h).
Anyway, i haven't tried doing a negative width or height, not sure what happens.
According to the specs: ( link (http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html) ) Viewport width and height are silently clamped to a range that depends on the implementation.
Spec also says:
Error GL_INVALID_VALUE is generated if either width or height is negative.
02-08-2008, 01:01 AM
glScalef (-1.0, 1.0, 1.0) doesn't do the trick.
Yes it does. It just depends where you put it. Normally you have
Change that to:
glScalef (-1.0, 1.0, 1.0);
02-08-2008, 01:47 AM
And don't forget to reverse what opengl considers front-facing polygons, else backface culling will not work as you expect.
It happened to me :)
02-08-2008, 02:44 AM
I tried to flip the projection matrix too, but it didn't work. May well have been due to face culling though. Thank you all very much, I'll try your suggestions.
Messing around with the viewport does not work. I need to flip the projection matrix and the face culling - the latter was the problem. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.