From a3a35f92bb41f02f5d37d3c6522308503ea4d73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 23 May 2009 12:40:04 +0000 Subject: [PATCH] Mirror the bottom cube cap in y direction. That makes cube a little bit more realistic. svn path=/trunk/KDE/kdebase/workspace/; revision=971753 --- effects/cube/cube.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index f1d1437f95..2e1423bbc1 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -400,7 +400,21 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glRotatef( (1-frontDesktop)*360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 ); glTranslatef( 0.0, rect.height(), 0.0 ); glCullFace( GL_FRONT ); + + // bottom texture has to be mirrored + glMatrixMode( GL_TEXTURE ); + glPushMatrix(); + glLoadIdentity(); + glScalef( 1.0f, -1.0f, 1.0f ); + glTranslatef( 0.0f, -1.0f, 0.0f ); + glMatrixMode( GL_MODELVIEW ); + glCallList( glList + 2 ); + + glMatrixMode( GL_TEXTURE ); + glPopMatrix(); + glMatrixMode( GL_MODELVIEW ); + glTranslatef( 0.0, -rect.height(), 0.0 ); glCullFace( GL_BACK ); glCallList( glList + 2 ); @@ -454,7 +468,20 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glRotatef( (1-frontDesktop)*360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 ); glTranslatef( 0.0, rect.height(), 0.0 ); glCullFace( GL_BACK ); + + // bottom texture has to be mirrored + glMatrixMode( GL_TEXTURE ); + glPushMatrix(); + glLoadIdentity(); + glScalef( 1.0f, -1.0f, 1.0f ); + glTranslatef( 0.0f, -1.0f, 0.0f ); + glMatrixMode( GL_MODELVIEW ); glCallList( glList + 2 ); + + glMatrixMode( GL_TEXTURE ); + glPopMatrix(); + glMatrixMode( GL_MODELVIEW ); + glTranslatef( 0.0, -rect.height(), 0.0 ); glCullFace( GL_FRONT ); glCallList( glList + 2 ); @@ -506,7 +533,20 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glPushMatrix(); glScalef( 1.0, -1.0, 1.0 ); } + + // bottom texture has to be mirrored + glMatrixMode( GL_TEXTURE ); + glPushMatrix(); + glLoadIdentity(); + glScalef( 1.0f, -1.0f, 1.0f ); + glTranslatef( 0.0f, -1.0f, 0.0f ); + glMatrixMode( GL_MODELVIEW ); + glCallList( glList + 2 ); + + glMatrixMode( GL_TEXTURE ); + glPopMatrix(); + glMatrixMode( GL_MODELVIEW ); if( mode == Sphere ) glPopMatrix(); glTranslatef( 0.0, -rect.height(), 0.0 ); @@ -581,7 +621,21 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glPushMatrix(); glScalef( 1.0, -1.0, 1.0 ); } + + // bottom texture has to be mirrored + glMatrixMode( GL_TEXTURE ); + glPushMatrix(); + glLoadIdentity(); + glScalef( 1.0f, -1.0f, 1.0f ); + glTranslatef( 0.0f, -1.0f, 0.0f ); + glMatrixMode( GL_MODELVIEW ); + glCallList( glList + 2 ); + + glMatrixMode( GL_TEXTURE ); + glPopMatrix(); + glMatrixMode( GL_MODELVIEW ); + if( mode == Sphere ) glPopMatrix(); glTranslatef( 0.0, -rect.height(), 0.0 );