From eed6b77ca454f8f8c29a54a3c5595f9c5aa9740a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 2 Dec 2003 21:38:52 +0000 Subject: [PATCH] Suggestion from Tree, changed tex coord scaling against textureWidth/Height rather than textureWidth-1 etc. --- src/osgText/Font.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/osgText/Font.cpp b/src/osgText/Font.cpp index 8ed061173..f5504004e 100644 --- a/src/osgText/Font.cpp +++ b/src/osgText/Font.cpp @@ -354,8 +354,9 @@ void Font::GlyphTexture::addGlyph(Glyph* glyph, int posX, int posY) // set up the details of where to place glyph's image in the texture. glyph->setTexture(this); glyph->setTexturePosition(posX,posY); - glyph->setMinTexCoord(osg::Vec2((float)(posX+_margin-1)/(float)(getTextureWidth()-1),(float)(posY+_margin-1)/(float)(getTextureHeight()-1))); - glyph->setMaxTexCoord(osg::Vec2((float)(posX+glyph->s()-_margin)/(float)(getTextureWidth()-1),(float)(posY+glyph->t()-_margin)/(float)(getTextureHeight()-1))); + unsigned int sizeAdjustment = 0; // was 1. + glyph->setMinTexCoord(osg::Vec2((float)(posX+_margin-1)/(float)(getTextureWidth()-sizeAdjustment),(float)(posY+_margin-1)/(float)(getTextureHeight()-sizeAdjustment))); + glyph->setMaxTexCoord(osg::Vec2((float)(posX+glyph->s()-_margin)/(float)(getTextureWidth()-sizeAdjustment),(float)(posY+glyph->t()-_margin)/(float)(getTextureHeight()-sizeAdjustment))); } void Font::GlyphTexture::apply(osg::State& state) const