From 60d343f1d7cc884567b1e04fa745f49603e22715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 10 Nov 2006 20:27:44 +0000 Subject: [PATCH] A great idea from Cedric Borgese: Instead of transforming the OpenGL scene to match X coordinate system, adjust it directly using glOrtho(). svn path=/branches/work/kwin_composite/; revision=603929 --- scene_opengl.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 5c07703aac..dbdabdd323 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -200,7 +200,8 @@ SceneOpenGL::SceneOpenGL( Workspace* ws ) // OpenGL scene setup glMatrixMode( GL_PROJECTION ); glLoadIdentity(); - glOrtho( 0, displayWidth(), 0, displayHeight(), 0, 65535 ); + // swap top and bottom to have OpenGL coordinate system match X system + glOrtho( 0, displayWidth(), displayHeight(), 0, 0, 65535 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); checkGLError( "Init" ); @@ -353,11 +354,6 @@ void SceneOpenGL::paint( QRegion damage, ToplevelList toplevels ) glPushMatrix(); glClearColor( 0, 0, 0, 1 ); glClear( GL_COLOR_BUFFER_BIT ); - // OpenGL has (0,0) in the bottom-left corner while X has it in the top-left corner, - // which is annoying and confusing. Therefore flip the whole OpenGL scene upside down - // and move it up, so that it actually uses the same coordinate system like X. - glScalef( 1, -1, 1 ); - glTranslatef( 0, -displayHeight(), 0 ); int mask = 0; paintScreen( &mask, &damage ); // call generic implementation glPopMatrix(); @@ -560,7 +556,7 @@ void SceneOpenGL::Window::bindTexture() { // convert to OpenGL coordinates (this is mapping // the pixmap to a texture, this is not affected - // by transforming the OpenGL scene) + // by using glOrtho() for the OpenGL scene) int gly = toplevel->height() - r.y() - r.height(); texture_y_inverted = false; glCopyTexSubImage2D( GL_TEXTURE_RECTANGLE_ARB, 0,