Hi,
I’ve run into three bugs with osgText.cpp with OSG 3.0.1.

The first happens when you use 
setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
 and you place text in any plane other than osgText::Text::XY_PLANE  The 
essence of the issue is the auto-sizing code doesn’t work correctly for text in 
any plane other than XY_PLANE.  I’ve attached the program and a screen shot 
showing the problem. The fix was simply scaling all 3 dimensions instead of 
just X and Y.

The second showed up with using osgText::Text::FILLEDBOUNDINGBOX draw mode with 
osgText::TextLYGON_OFFSET backdropImplementation with a osglygonOffset 
stateAttribute attached.   osgText.cpp wasn’t respecting the PolygonOffset in 
the current State.   I also noticed some incorrect values in a couple 
glPushAttrib calls.

I’ve attached a patch file generated by SVN.

Thanks,
John.

<<wlEmoticon-surprisedsmile[1].png>>

#include <osg/Geode>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <osgText/Text>

void main(int argc, char*argv[])
{
    osgText::Text* text = new osgText::Text;
    
text->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
    text->setAxisAlignment(osgText::Text::XZ_PLANE);
    text->setFont(osgText::readFontFile("fonts/arial.ttf"));
    text->setFontResolution(32,32);
    text->setCharacterSize(1.f);
    text->setText("text");

    osg::Geode* root = new osg::Geode;
    root->addDrawable(text);

    osgGA::TrackballManipulator* manip = new osgGA::TrackballManipulator;
    manip->setHomePosition(osg::Vec3(0,-3,0),osg::Vec3(0,0,0),osg::Vec3(0,0,1));

    osgViewer::Viewer viewer;
    viewer.setUpViewInWindow(16,32,640,480);
    viewer.setCameraManipulator(manip);
    viewer.setSceneData(root);
    viewer.run();
}

<<attachment: bug.jpg>>

Attachment: Text.cpp.patch
Description: Binary data

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to