diff options
author | Ton Roosendaal <ton@blender.org> | 2005-05-12 01:09:13 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-05-12 01:09:13 +0400 |
commit | 884c94500bce8545aa988a85136e49948b245d05 (patch) | |
tree | 22ea7f93c0f07dc3c512e97a6d3c0cbd3791a09d /extern/bFTGL/src/FTTextureGlyph.cpp | |
parent | 6bc1dd46654a70cbaef69a2248cf17175788e35b (diff) |
Another update on FTGL texture fonts drawing. Added the same floor() trick
to precisely align the glyphs to pixel coordinates as used in the Pixmap
version. It now looks fully identical here.
Diffstat (limited to 'extern/bFTGL/src/FTTextureGlyph.cpp')
-rwxr-xr-x | extern/bFTGL/src/FTTextureGlyph.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/extern/bFTGL/src/FTTextureGlyph.cpp b/extern/bFTGL/src/FTTextureGlyph.cpp index 4b29268f1ce..b8267dcce89 100755 --- a/extern/bFTGL/src/FTTextureGlyph.cpp +++ b/extern/bFTGL/src/FTTextureGlyph.cpp @@ -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; |