[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kstars-devel
Subject:    [Kstars-devel]
From:       Khudyakov Alexey <alexey.skladnoy () gmail ! com>
Date:       2011-05-05 12:20:30
Message-ID: 20110505122030.A9DDDA60CB () git ! kde ! org
[Download RAW message or body]

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

_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic