Hi Vincent, I've never used osgText in conjunction with osg::Billboard before. I can image the mix of on the fly compute matrices might cause problems. osgText has support for billboard behaviour so I'd recommend not adding the text to the billboard, instead just add it as sibling to the Billboard and enable the rotate to screen option on the text object.
Robert. On Tue, Jan 13, 2009 at 11:59 AM, Vincent Bourdier <[email protected]> wrote: > Hi, > > Currently making my billboard node, I add an osgText on it. I need this text > to be in node's coordinate, but in constant pixel size on screen. > When the billboard move or rotate, the text will follow it. The only thing > the text can change is caracter size. > > I use this code : > > osg::ref_ptr<osgText::Text> d = new osgText::Text; > > d->setRotation(osg::Quat(-osg::PI_2, osg::Vec3f(1,0,0)) * > osg::Quat(-osg::PI_2, osg::Vec3f(0,1,0))); > > d->setPosition(decal*0.7);//to avoid collision between object and > osgText > > d->setText("Test"); > d->setAxisAlignment(osgText::Text::USER_DEFINED_ROTATION); > d->setAutoRotateToScreen(false); > d->setCharacterSizeMode(osgText::Text::SCREEN_COORDS); > d->setCharacterSize(30); > d->setAlignment(osgText::Text::CENTER_TOP); > // d->setDrawMode(1); > > billboard->addDrawable(d.get()); > > But the setRotation is making something bad. > > Without the setRotation line node, everything is good for text size. > Rotation is bad but it is something expected. > So I apply a rotation on it, to obtain the text with the good orientation > relative to the billboard. After that, the text rotation is good, but when > the camera is aproaching, the text size do not update correctly : only the > width stay constant in pixel size... the hight stay constant in billboard > coordinates size. So the text is deformed, depending on camera distance from > it.. > > The question is : how to rotate the text without having this bad effect ? > > Thanks. > > Regards, > Vincent. > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

