Added use of OSG_MAX_TEXTURE_SIZE for clamping texture sizes.
This commit is contained in:
parent
5d23bf7739
commit
77b4ffcac2
@ -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
|
||||
@ -533,6 +552,9 @@ void Font::GlyphTexture::apply(osg::State& state) const
|
||||
}
|
||||
|
||||
|
||||
osg::notify(osg::NOTICE)<<"Texture width = "<<getTextureWidth()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"Texture height = "<<getTextureHeight()<<std::endl;
|
||||
|
||||
// allocate the texture memory.
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
|
||||
getTextureWidth(), getTextureHeight(), 0,
|
||||
|
Loading…
Reference in New Issue
Block a user