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;
|
_texenv = new osg::TexEnv;
|
||||||
_stateset = new osg::StateSet;
|
_stateset = new osg::StateSet;
|
||||||
_stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
_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()
|
Font::~Font()
|
||||||
@ -214,6 +224,15 @@ void Font::setTextureSizeHint(unsigned int width,unsigned int height)
|
|||||||
{
|
{
|
||||||
_textureWidthHint = width;
|
_textureWidthHint = width;
|
||||||
_textureHeightHint = height;
|
_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
|
unsigned int Font::getTextureWidthHint() const
|
||||||
@ -532,6 +551,9 @@ void Font::GlyphTexture::apply(osg::State& state) const
|
|||||||
imageData[i] = 0;
|
imageData[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
osg::notify(osg::NOTICE)<<"Texture width = "<<getTextureWidth()<<std::endl;
|
||||||
|
osg::notify(osg::NOTICE)<<"Texture height = "<<getTextureHeight()<<std::endl;
|
||||||
|
|
||||||
// allocate the texture memory.
|
// allocate the texture memory.
|
||||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
|
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
|
||||||
|
Loading…
Reference in New Issue
Block a user