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

List:       kde-commits
Subject:    =?utf-8?q?=5Bkstars=5D_kstars=3A_Same_for_text_labels?=
From:       Khudyakov Alexey <alexey.skladnoy () gmail ! com>
Date:       2011-05-05 12:20:30
Message-ID: 20110505122030.AC186A60CD () git ! kde ! org
[Download RAW message or body]

Git commit c81b5699a337dab37411960c60e2b2ff24bfe202 by Khudyakov Alexey.
Committed on 05/05/2011 at 14:19.
Pushed by khudyakov into branch 'master'.

Same for text labels

M  +5    -20   kstars/skyglpainter.cpp     

http://commits.kde.org/kstars/c81b5699a337dab37411960c60e2b2ff24bfe202

diff --git a/kstars/skyglpainter.cpp b/kstars/skyglpainter.cpp
index 8189cc7..76944bb 100644
--- a/kstars/skyglpainter.cpp
+++ b/kstars/skyglpainter.cpp
@@ -564,26 +564,11 @@ void SkyGLPainter::drawText( int x, int y, const QString text, QFont font, QColo
     p.end();
 
     // Create texture
-    TextureManager::bindFromImage( text_image, m_widget );
-    glEnable(GL_TEXTURE_2D);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-    Vector2f vec( x, y );
-    Vector2f vertex;
-    glBegin(GL_QUADS);
-        vertex = vec + Vector2f( 10, text_image.height()/2 -10 );
-        glTexCoord2f(0.,0.);
-        glVertex2fv(vertex.data());
-        vertex = vec + Vector2f( text_image.width() + 10, text_image.height()/2 -10 );
-        glTexCoord2f(1.,0.);
-        glVertex2fv(vertex.data());
-        vertex = vec + Vector2f( text_image.width() + 10, text_image.height()/2*(-1) - 10 );
-        glTexCoord2f(1.,1.);
-        glVertex2fv(vertex.data());
-        vertex = vec + Vector2f( 10, text_image.height()/2*(-1) - 10 );;
-        glTexCoord2f(0.,1.);
-        glVertex2fv(vertex.data());
-    glEnd();
+    float w = text_image.width();
+    float h = text_image.height();
+    float vx = x + 0.5*w + 10;
+    float vy = y - 10;
+    drawTexturedRectangle( text_image, Vector2f(vx,vy), 0, w, h );
 }
 
 void SkyGLPainter::drawSkyLine(SkyPoint* a, SkyPoint* b)

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

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