From b296b7a00c10ed1fe9bd430740abc286e8db2b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 21 Jul 2010 16:36:26 +0000 Subject: [PATCH] Generate correct tex coordinates for rendering a texture. This way we can get rid of the texture matrix transformations when rendering a standard texture - no matter if it's inverted or not. svn path=/trunk/KDE/kdebase/workspace/; revision=1152649 --- lib/kwinglutils.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 3fea301914..4cd017df40 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -520,19 +520,17 @@ void GLTexture::render( QRegion region, const QRect& rect ) }; const float texcoords[ 4 * 2 ] = { - 0.0f, 1.0f, // y needs to be swapped (normalized coords) - 0.0f, 0.0f, - 1.0f, 1.0f, - 1.0f, 0.0f + 0.0f, y_inverted ? 0.0f : 1.0f, // y needs to be swapped (normalized coords) + 0.0f, y_inverted ? 1.0f : 0.0f, + 1.0f, y_inverted ? 0.0f : 1.0f, + 1.0f, y_inverted ? 1.0f : 0.0f }; m_vbo->setData( 4, 2, verts, texcoords ); } } if( m_vbo ) { - enableNormalizedTexCoords(); m_vbo->render( region, GL_TRIANGLE_STRIP ); - disableNormalizedTexCoords(); } else { @@ -545,14 +543,12 @@ void GLTexture::render( QRegion region, const QRect& rect ) }; const float texcoords[ 4 * 2 ] = { - 0, 1, // y needs to be swapped (normalized coords) - 0, 0, - 1, 0, - 1, 1 + 0.0f, y_inverted ? 0.0f : 1.0f, // y needs to be swapped (normalized coords) + 0.0f, y_inverted ? 1.0f : 0.0f, + 1.0f, y_inverted ? 1.0f : 0.0f, + 1.0f, y_inverted ? 0.0f : 1.0f }; - enableNormalizedTexCoords(); renderGLGeometry( region, 4, verts, texcoords ); - disableNormalizedTexCoords(); } }