Another update on FTGL texture fonts drawing. Added the same floor() trick
authorTon Roosendaal <ton@blender.org>
Wed, 11 May 2005 21:09:13 +0000 (21:09 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 11 May 2005 21:09:13 +0000 (21:09 +0000)
to precisely align the glyphs to pixel coordinates as used in the Pixmap
version. It now looks fully identical here.

extern/bFTGL/src/FTTextureGlyph.cpp
source/blender/src/space.c

index 4b29268f1ce6b10b559acd3c5ed8bd3d3d133b54..b8267dcce896de81bb14d796afebca2990949e11 100755 (executable)
@@ -54,27 +54,32 @@ FTTextureGlyph::FTTextureGlyph( FT_GlyphSlot glyph, int id, int xOffset, int yOf
 FTTextureGlyph::~FTTextureGlyph()
 {}
 
+#include <math.h>
 
 float FTTextureGlyph::Render( const FTPoint& pen)
 {
+       float dx;
+       
     glGetIntegerv( GL_TEXTURE_2D_BINDING_EXT, &activeTextureID);
     if( activeTextureID != glTextureID)
     {
         glBindTexture( GL_TEXTURE_2D, (GLuint)glTextureID);
     }
     
+       dx= floor( (pen.x + pos.x ) );
+       
     glBegin( GL_QUADS);
         glTexCoord2f( uv[0].x, uv[0].y);
-        glVertex2f( pen.x + pos.x,             pen.y + pos.y);
+        glVertex2f( dx,             pen.y + pos.y);
 
         glTexCoord2f( uv[0].x, uv[1].y);
-        glVertex2f( pen.x + pos.x,             pen.y + pos.y - destHeight);
+        glVertex2f( dx,             pen.y + pos.y - destHeight);
 
         glTexCoord2f( uv[1].x, uv[1].y);
-        glVertex2f( pen.x + destWidth + pos.x, pen.y + pos.y - destHeight);
+        glVertex2f( dx + destWidth, pen.y + pos.y - destHeight);
         
         glTexCoord2f( uv[1].x, uv[0].y);
-        glVertex2f( pen.x + destWidth + pos.x, pen.y + pos.y);
+        glVertex2f( dx + destWidth, pen.y + pos.y);
     glEnd();
 
     return advance;
index a49f5167e775a395d18d942690690123a9e819ea..d41d0868d1191c2561740500b16508959ecd7b6d 100644 (file)
@@ -2281,10 +2281,10 @@ void drawinfospace(ScrArea *sa, void *spacedata)
 
        if(curarea->winx<=1280.0) {
                fac= ((float)curarea->winx)/1280.0f;
-               myortho2(0.0, 1280.0, 0.0, curarea->winy/fac);
+               myortho2(0.375, 1280.375, 0.375, curarea->winy/fac + 0.375);
        }
        else {
-               myortho2(0.0, (float)curarea->winx, 0.0, (float)curarea->winy);
+               myortho2(0.375, (float)curarea->winx + 0.375, 0.375, (float)curarea->winy + 0.375);
        }
        
        sprintf(naam, "infowin %d", curarea->win);