[Kstars-devel] [kstars] kstars: Fix mirroring of planet images by mirroring texture.

Khudyakov Alexey alexey.skladnoy at gmail.com
Thu May 5 14:20:30 CEST 2011


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 at 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();
 



More information about the Kstars-devel mailing list