diff --git a/include/osgText/Text b/include/osgText/Text index 51948934f..b28d09e8b 100644 --- a/include/osgText/Text +++ b/include/osgText/Text @@ -73,11 +73,16 @@ class OSGTEXT_EXPORT Text : public osg::Drawable virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } virtual const char* className() const { return "Text"; } - void setPosition(const osg::Vec2& pos); void setPosition(const osg::Vec3& pos); const osg::Vec3& getPosition() const { return _pos; } + + void setColor(const osg::Vec4& color) { _color = color; } + osg::Vec4& getColor() { return _color; } + const osg::Vec4& getColor() const { return _color; } + + void setDrawMode(int mode) { _drawMode=mode; } int getDrawMode() const { return _drawMode; } @@ -132,8 +137,9 @@ class OSGTEXT_EXPORT Text : public osg::Drawable int _drawMode; int _boundingBoxType; - osg::Vec3 _pos; - osg::Vec3 _alignmentPos; + osg::Vec3 _pos; + osg::Vec3 _alignmentPos; + osg::Vec4 _color; }; } diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index bfa193d3d..314cbb576 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -46,7 +46,8 @@ Text::Text(const Text& text,const osg::CopyOp& copyop): _drawMode(text._drawMode), _boundingBoxType(text._boundingBoxType), _pos(text._pos), - _alignmentPos(text._alignmentPos) + _alignmentPos(text._alignmentPos), + _color(text._color) { } @@ -112,6 +113,8 @@ setDefaults() _pos.set(0,0,0); _alignmentPos.set(0,0,0); + _color.set(1.0f,1.0f,1.0f,1.0f); + _fontType=UNDEF; _alignment=LEFT_BOTTOM; _drawMode=DEFAULT; @@ -190,6 +193,8 @@ void Text::drawImmediateMode(State& state) // draw boundingBox if(_drawMode & TEXT) { + glColor3fv(_color.ptr()); + Vec3 drawPos(_pos+_alignmentPos); glPushMatrix(); switch(_fontType)