From 77b4ffcac251c83217aa4c42bbf0f4f8f3473d9e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 9 May 2007 10:31:06 +0000 Subject: [PATCH] Added use of OSG_MAX_TEXTURE_SIZE for clamping texture sizes. --- src/osgText/Font.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/osgText/Font.cpp b/src/osgText/Font.cpp index 3e57353f1..99c56f114 100644 --- a/src/osgText/Font.cpp +++ b/src/osgText/Font.cpp @@ -145,6 +145,16 @@ Font::Font(FontImplementation* implementation): _texenv = new osg::TexEnv; _stateset = new osg::StateSet; _stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); + + char *ptr; + if( (ptr = getenv("OSG_MAX_TEXTURE_SIZE")) != 0) + { + GLint osg_max_size = atoi(ptr); + + if (osg_max_size<_textureWidthHint) _textureWidthHint = osg_max_size; + if (osg_max_size<_textureHeightHint) _textureHeightHint = osg_max_size; + } + } Font::~Font() @@ -214,6 +224,15 @@ void Font::setTextureSizeHint(unsigned int width,unsigned int height) { _textureWidthHint = width; _textureHeightHint = height; + + char *ptr; + if( (ptr = getenv("OSG_MAX_TEXTURE_SIZE")) != 0) + { + GLint osg_max_size = atoi(ptr); + + if (osg_max_size<_textureWidthHint) _textureWidthHint = osg_max_size; + if (osg_max_size<_textureHeightHint) _textureHeightHint = osg_max_size; + } } unsigned int Font::getTextureWidthHint() const @@ -532,6 +551,9 @@ void Font::GlyphTexture::apply(osg::State& state) const imageData[i] = 0; } + + osg::notify(osg::NOTICE)<<"Texture width = "<