Added TexEnv object into Font and apply this in Text::drawImplementation to make
sure that a valid TexEnv is applied
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/buffered_value>
|
||||
#include <osg/TexEnv>
|
||||
|
||||
#include <osgText/Export>
|
||||
|
||||
@@ -87,6 +88,9 @@ public:
|
||||
|
||||
virtual std::string getFileName() const;
|
||||
|
||||
void setTexEnv(osg::TexEnv* texenv) { if (texenv) _texenv = texenv; }
|
||||
inline osg::TexEnv* getTexEnv() { return _texenv.get(); }
|
||||
inline const osg::TexEnv* getTexEnv() const { return _texenv.get(); }
|
||||
|
||||
void setStateSet(osg::StateSet* stateset) { _stateset = stateset; }
|
||||
osg::StateSet* getStateSet() { return _stateset.get(); }
|
||||
@@ -157,6 +161,7 @@ protected:
|
||||
typedef std::map< SizePair, GlyphMap > SizeGlyphMap;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::TexEnv> _texenv;
|
||||
osg::ref_ptr<osg::StateSet> _stateset;
|
||||
SizeGlyphMap _sizeGlyphMap;
|
||||
GlyphTextureList _glyphTextureList;
|
||||
|
||||
@@ -142,9 +142,8 @@ Font::Font(FontImplementation* implementation):
|
||||
{
|
||||
setImplementation(implementation);
|
||||
|
||||
_texenv = new osg::TexEnv;
|
||||
_stateset = new osg::StateSet;
|
||||
//_stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
//_stateset->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
_stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <osg/GL>
|
||||
#include <osg/Notify>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/TexEnv>
|
||||
|
||||
#include <osgUtil/CullVisitor>
|
||||
|
||||
@@ -1452,6 +1453,7 @@ void Text::drawImplementation(osg::State& state) const
|
||||
|
||||
state.applyMode(GL_BLEND,true);
|
||||
state.applyTextureMode(0,GL_TEXTURE_2D,true);
|
||||
state.applyTextureAttribute(0,getActiveFont()->getTexEnv());
|
||||
|
||||
if (_characterSizeMode!=OBJECT_COORDS || _autoRotateToScreen)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user