renmenziji 发表于 2019-2-21 12:29:20

请教一个Text消失的问题.



请教大家一个小问题,我做了一个小程序,为何文字老是消失(感觉低于垂直于平面0点则存在,否则则消失).而同是这个group中的别的东西则会存在.


代码如下


        osg::ref_ptr<osg::Geode> textgeode = new osg::Geode();
        osg::ref_ptr<osgText::TextBase> myText = new osgText::Text;
        myText->setDataVariance(osg::Object::STATIC);
        myText->setFontResolution(128.0f, 128.0f);
        myText->setPosition(p1);
        myText->setCharacterSize(txtSize);
        myText->setAxisAlignment(osgText::TextBase::SCREEN);
        myText->setCharacterSizeMode(osgText::TextBase::SCREEN_COORDS);
        myText->setAutoRotateToScreen(true);
        //osg::AutoTransform::AutoRotateMode autoMode;
        //annot->setAutoRotateToScreen(autoMode);
        myText->setText(text);
        myText->setColor(annotclr);
        if (font) myText->setFont(font);
        textgeode->addDrawable(myText);
        osg::ref_ptr<osg::Group> grp = new osg::Group;
        grp->addChild(textgeode);
页: [1]
查看完整版本: 请教一个Text消失的问题.