From kde-commits Thu May 05 12:20:30 2011 From: Khudyakov Alexey Date: Thu, 05 May 2011 12:20:30 +0000 To: kde-commits Subject: =?utf-8?q?=5Bkstars=5D_kstars=3A_Fix_mirroring_of_planet_images_?= Message-Id: <20110505122030.A9DDDA60CB () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=130459810802644 Git commit 3f0fbe62ace6b29b4380506a57e2692d66875ed6 by Khudyakov Alexey. Committed on 05/05/2011 at 13:06. Pushed by khudyakov into branch 'master'. Fix mirroring of planet images by mirroring texture. This is due to differences in coordinate systems in QPainter (left) and OpenGL (right) CCMAIL: kstars-devel@kde.org M +8 -4 kstars/skyglpainter.cpp http://commits.kde.org/kstars/3f0fbe62ace6b29b4380506a57e2692d66875ed6 diff --git a/kstars/skyglpainter.cpp b/kstars/skyglpainter.cpp index 928f968..612a04f 100644 --- a/kstars/skyglpainter.cpp +++ b/kstars/skyglpainter.cpp @@ -204,16 +204,20 @@ bool SkyGLPainter::drawPlanet(KSPlanetBase* planet) glScalef( s, s, 1 ); glBegin(GL_QUADS); - glTexCoord2f( 0, 0); + // Note! Y coordinate of texture is mirrored w.r.t. to + // vertex coordinates to account for difference between + // OpenGL and QPainter coordinate system. + // Otherwise image would appear mirrored + glTexCoord2f( 0, 1); glVertex2f( -1, -1); - glTexCoord2f( 1, 0); + glTexCoord2f( 1, 1); glVertex2f( 1, -1); - glTexCoord2f( 1, 1); + glTexCoord2f( 1, 0); glVertex2f( 1, 1); - glTexCoord2f( 0, 1); + glTexCoord2f( 0, 0); glVertex2f( -1, 1); glEnd();