当前位置:网站首页>OSG笔记:使用setFontResolution设置字体分辨率
OSG笔记:使用setFontResolution设置字体分辨率
2022-08-09 22:01:00 【shanql】
setFontResolution
使用类osgText::Text成员函数setFontResolution, 可以设置字符的分辨,值越大,字符越清晰。这个要看出效果,可以将单个字符的高度设置的大一点,如300, 然后调用setFontResolution(16, 16)
。这样就可以看出效果。
示例核心代码
osg::ref_ptr<osg::Group> pRoot = new osg::Group();
osg::ref_ptr<osg::Geode> pTextGeode = new osg::Geode();
pRoot->addChild(pTextGeode);
for (int i = 0; i < 10; ++i)
{
osgText::Text* pText = new osgText::Text();
pText->setFont("simfang.ttf");
pText->setFontResolution(8*(i+1), 8*(i+1));//字体分辨率,值越大越清晰
pText->setText(L"中文支持你好");
pText->setPosition(osg::Vec3(0, i*320, 0));
pText->setCharacterSize(300, 1.0 );
pTextGeode->addDrawable(pText);
}
运行截图
边栏推荐
- 第十七期八股文巴拉巴拉说(数据库篇)
- Postgresql源码(68)virtualxid锁的原理和应用场景
- 反射机制篇
- Chatting embarrassing scenes, have you encountered it?Teach you to get the Doutu emoticon package with one click, and become a chat expert
- Under the NVM node installation;The node environment variable configuration
- 1215 – Cannot add foreign key constraint
- 【EF】 更新条目时出错。有关详细信息,请参见内部异常。[通俗易懂]
- 力扣 1413. 逐步求和得到正数的最小值
- Easyui 表单验证「建议收藏」
- 【微服务~Nacos】Nacos之配置中心
猜你喜欢
随机推荐
nvm下node安装;node环境变量配置
发送激活邮件「建议收藏」
R语言拟合ARIMA模型并使用拟合模型进行预测推理:使用forecast函数计算ARIMA模型未来值(包含时间点、预测值、两个置信区间)
AI+Medical: Using Neural Networks for Medical Image Recognition and Analysis
leetcode:319. 灯泡开关
注意力引导网络用于视网膜图像分割
五星控股汪建国:以“植物精神”深耕赛道,用“动物精神”推动成长
Xiaohei leetcode's refreshing rainy day trip, just finished eating Yufei Beef Noodles, Mala Tang and Beer: 112. Path Sum
D. Binary String To Subsequences
BulkInsert方法实现批量导入
为什么这么多人都想当产品经理?
十步以内,用小程序快速生成App!
Xiaohei's leetcode journey: 94. Inorder traversal of binary trees (supplementary Morris inorder traversal)
Jinshanyun earthquake, the epicenter is in bytes?
shell学习
Chatting embarrassing scenes, have you encountered it?Teach you to get the Doutu emoticon package with one click, and become a chat expert
金山云地震,震源在字节?
月薪5K的运维小白如何成为月薪5W的高级架构师?
【软考 系统架构设计师】案例分析④ 软件架构风格
In-depth analysis of Apache EventMesh cloud-native distributed event-driven architecture