Hi Thorsten,

textobj is a local object in your constructor, not a member of your class. Here are the changes you need.

class TGTextNode : public osg::Geode
{
public:
    TGTextNode(std::string T_Text, int T_Size, int T_Res, int T_PosX,
        int T_PosY, int T_PosZ);

    void addOutline();

  protected:
      osg::ref_ptr<osgText::Text> _textobj;

};

TGTextNode::TGTextNode(std::string T_Text, int T_Size, int T_Res, int T_PosX,
        int T_PosY, int T_PosZ)
{

        _textobj = new osgText::Text;
        // Then replace all textobj with _textobj below

        textobj->setAlignment(osgText::Text::CENTER_CENTER);
        textobj->setCharacterSize(T_Size);
        textobj->setFont("bewilder.ttf");
        textobj->setFontResolution(T_Res, T_Res);
        textobj->setPosition(osg::Vec3(T_PosX, T_PosY, T_PosZ));
        textobj->setColor(osg::Vec4(100, 50, 0, 1));
        textobj->setAxisAlignment(osgText::Text::SCREEN);
        textobj->setText(T_Text);
        //textobj->setBackdropType(osgText::Text::OUTLINE);
        //textobj->setBackdropColor(osg::Vec4(1,.1,.1,1));
        textobj->setDataVariance(osg::Object::DYNAMIC);
        this->addDrawable(textobj.get());
}

void TGTextNode::addOutline()
{
        textobj->setBackdropType(osgText::Text::OUTLINE);
        textobj->setBackdropColor(osg::Vec4(1,.1,.1,1));
}


I know that this is maybe a bit noobish, but im really stuck here.

No offense, but I think you need to pick up a book on C++ or programming in general. These are not noobish about OSG, they are noobish about programming, and we're normally here to answer questions about OSG itself...

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to