当前位置:网站首页>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);
}
运行截图

边栏推荐
猜你喜欢

leetcode:319. 灯泡开关

leetcode:323. 无向图中连通分量的数目

Analyze the Add() method in Fragment management from the source code

js十五道面试题(含答案)

任务流执行器是如何工作的?

2022年中国第三方证券APP创新专题分析

月薪5K的运维小白如何成为月薪5W的高级架构师?

C 在函数声明前加typedef

重装系统后新建文本文档打不开怎么办
![This article lets you quickly understand implicit type conversion [integral promotion]!](/img/16/4edc7ef23384b22d50ebd894b8911a.png)
This article lets you quickly understand implicit type conversion [integral promotion]!
随机推荐
JuiceFS 在多云存储架构中的应用 | 深势科技分享
Blender程序化建模简明教程【PCG】
Evolution of MLOps
Liver all night to write a thirty thousand - word all the commands the SQL database, function, speaks clearly explain operators, content is rich, proposal collection + 3 even high praise!
Interviewer: How to deal with Redis big key?
Presto Event Listener开发
[Cloud Native] 4.2 DevOps Lectures
R语言将列表数据转化为向量数据(使用unlist函数将列表数据转化为向量数据)
Basic operations of openGauss database (super detailed)
C. Binary String Reconstruction
shell学习
leetcode:332. 重新安排行程
一本通2074:【21CSPJ普及组】分糖果(candy)
2022 首期线下 Workshop!面向应用开发者们的数据应用体验日来了 | TiDB Workshop Day
[Microservice~Nacos] Nacos service provider and service consumer
Xiaohei leetcode's refreshing rainy day trip, just finished eating Yufei Beef Noodles, Mala Tang and Beer: 112. Path Sum
JSON 基本使用
js十五道面试题(含答案)
跨端技术方案选什么好?
【服务器数据恢复】SAN LUN映射出错导致文件系统数据丢失的数据恢复案例