|
楼主 |
发表于 2011-8-23 13:42:35
|
显示全部楼层
本帖最后由 a456759 于 2011-8-23 14:00 编辑
- #include <osgDB/ReadFile>
- #include <osgDB/WriteFile>
- #include <osgDB/Registry>
- #include <osgViewer/Viewer>
- #include <osgViewer/ViewerEventHandlers>
- #include <osg/Geode>
- #include <osg/Camera>
- #include <osg/ShapeDrawable>
- #include <osg/Sequence>
- #include <osg/PolygonMode>
- #include <osg/io_utils>
- #include <osgText/Font>
- #include <osgText/Text>
- int main()
- {
- osg::Group* root=new osg::Group();
- osg::Geode* textgeode=new osg::Geode();
- osgText::Text* test=new osgText::Text();
- test->setFont("simhei.ttf");
- test->setText(L"测试是否成功?");
- test->setCharacterSize(32);
- test->setAxisAlignment(osgText::Text::XZ_PLANE);
- test->setAlignment(osgText::Text::CENTER_CENTER);
- test->setPosition(osg::Vec3(0.0,0.0,0.0));
- test->setColor(osg::Vec4(1.0,0.0,0.0,1.0));
- textgeode->addDrawable(test);
- root->addChild(textgeode);
- osgViewer::Viewer view;
- view.setSceneData(root);
- view.run();
- }
复制代码 回复 2# gis_wudi
现在好了,虽然不知道为什么。。但是当我把那个exe文件拷贝到别的电脑时,再次发现font文件找不到了,新电脑上在window的fonts目录下有simhei.ttf 文件呀。我把simhei.ttf和exe放在一起也不行,这是什么原因啊?exe不会自动从本目录搜索嘛?
|
|