Ogre嵌入Qt:布告板显示中文(补充)
来源:互联网 发布:新手怎样开淘宝店 编辑:程序博客网 时间:2024/06/13 22:29
Ogre 嵌入 Qt
使用的:OgreMovableText 类会造成程序崩溃,错误代码:
mpFont = FontManager::getSingleton().getByName(mFontName);
解决方法:
在使用OgreMovableText 类前,先在主程序构造函数中进行初始化、预加载操作:
// 初始化、预加载字体bool createSceneFont(){ Ogre::OverlaySystem* pOverlaySystem = new Ogre::OverlaySystem(); m_pSceneManager->addRenderQueueListener(pOverlaySystem); Ogre::FontPtr tempFont = static_cast<Ogre::FontPtr>(Ogre::FontManager::getSingleton().create("SdkTrays/Caption", "Popular")); tempFont->setType(Ogre::FontType::FT_TRUETYPE); // 字体类型 tempFont->setSource("msyh.ttf"); // 字体源(微软雅黑) tempFont->setTrueTypeResolution(96); // 字体的打印分辨率,一般为96 tempFont->setTrueTypeSize(32); // 字体大小: 生成纹理的大小,值越大生成纹理所花的时间也就越多 tempFont->addCodePointRange(Ogre::Font::CodePointRange(33,126)); // 英文-unicode的int值范围 tempFont->addCodePointRange(Ogre::Font::CodePointRange(19968,40869)); // 汉字-unicode的int值范围 m_font = tempFont; m_font->load(); if (m_font.isNull()) { return false; } return true;}
创建中文文字:
// 显示中文文字Ogre::SceneNode* nodeTemp = m_pSceneManager->getRootSceneNode()->createChildSceneNode("line");nodeTemp->setPosition(Ogre::Vector3(0, 0, 0));Ogre::ColourValue textColor = Ogre::ColourValue(0.5f, 0.0f, 1.0f);Ogre::DisplayString str = Ogre::DisplayString(L"食人魔");Ogre::MovableText* mt = new Ogre::MovableText("temp1", str, "SdkTrays/Caption", 1, textColor);mt->showOnTop(true);mt->setTextAlignment(Ogre::MovableText::HorizontalAlignment::H_CENTER, Ogre::MovableText::VerticalAlignment::V_ABOVE);nodeTemp->attachObject(mt);
0 0
- Ogre嵌入Qt:布告板显示中文(补充)
- OGRE布告板与粒子
- OGRE布告板与粒子
- 移动模型后面跟随轨迹,模型和布告板之间的连线、布告板显示中文
- OGRE嵌入QT运行不了....
- osg布告板技术(Billboard)
- OGRE显示中文
- 将ogre 嵌入到 Qt中
- 将ogre 嵌入到 Qt中
- 将ogre 嵌入到 Qt中
- 将ogre 嵌入到 Qt中
- ogre字体生成(中文显示)
- Ogre 代码分析 -- 中文显示
- PCL嵌入VTK/QT显示
- 布告板技术创建树木
- OGRE嵌入MFC(含源码)
- cocos2d-x显示中文,补充方法(3)
- 在OGRE中用CEGUI显示中文
- Kilim框架的Actor并发模型
- Xcode 8.3 (iOS 10.3)新增应用内评价API 之 SKStoreReviewController
- 学习感觉
- 【记录】2种随机迷宫生成算法的cpp实现
- 380. Insert Delete GetRandom O(1)
- Ogre嵌入Qt:布告板显示中文(补充)
- 资料_编程_大杂烩
- Java并发编程总结
- poj1703 Find them, Catch them
- 在eclipse上搭建mapreduce开发环境及运行wordcount
- Hue安装配置实践
- hdu 1027 Ignatius and the Princess II (全排列)
- 噩梦射手(SurvivalShooter)教程(四)
- 命令行编译运行java程序