Hi,
I would like to display text with constant size in pixels, so I have
used CharacterSizeMode as in the simple code sample below:

///////////////// code start
#include <osg/ref_ptr>
#include <iostream>
#include <osg/Geode>
#include <osgText/Text>
#include <osgText/Font>
#include <osgViewer/Viewer>

osg::ref_ptr<osg::Node> createSceneGraph() {
//this create geode with text "C++"
osg::ref_ptr<osg::Geode> textGeode = new osg::Geode;
osg::ref_ptr<osgText::Font> font = osgText::readFontFile("fonts/arial.ttf");

osg::ref_ptr<osgText::Text> text = new osgText::Text;
text->setFont(font.get());
text->setFontResolution(256,256);
text->setText("C++");
text->setAxisAlignment(osgText::Text::SCREEN);
text->setCharacterSize(500);

//this is the problem
text->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);

textGeode->addDrawable(text.get());
return textGeode.get();
}

int main(int, char **) {
osg::ref_ptr<osg::Node> root = createSceneGraph();
osgViewer::Viewer viewer;
viewer.setUpViewInWindow(0,0,1000,300);
viewer.setSceneData(root.get());
return viewer.run();
}
///////////////// code end

But the problem is that the text is contracted. It has right proportion
only when I use squere window. I could see the same efect also with
the osgtext example (more clearly if you use higher aspect ratio window).
I am using widescreen display but it should be no problem.
Did I forgot something or is it standart behaviour when using SCREEN_COORDS?
And also the real text size is not what I requested (500 pixels).

Here is image of the sample window:
http://www.cotopaxi.cz/m/text.jpg

Thank you,

Martin

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to