#ifdef _WIN32
#include <Windows.h>
#endif // _WIN32
#include<iostream> #include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/CompositeViewer> #include <osgDB/ReadFile> #include <osg/Geode>
#include <osg/Node>
#include <osg/Geometry>
#include <osg/GraphicsContext>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osg/Image>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osg/TexGen>
#include <osg/NodeVisitor>
#include <osg/MatrixTransform>
#include <osg/PositionAttitudeTransform>
#include <osg/AnimationPath>
#include <osg/Matrixd>
#include <osg/PagedLOD>
#include <osg/Camera>
#include <osgText/Text> #include <osgGA/TrackballManipulator>
#include <osgGA/GUIEventHandler>
#include <osgGA/CameraManipulator>
#include <osgGA/StandardManipulator>
#include <osgGA/OrbitManipulator>
#include <osgGA/TrackballManipulator> #include <osgUtil/IntersectionVisitor>
#include <osgUtil/LineSegmentIntersector> osg::Camera* createTextHUD()
{
osg::ref_ptr<osg::Geode> geode1 = new osg::Geode;
osg::ref_ptr<osgText::Text> text1 = new osgText::Text;
osg::ref_ptr<osg::Camera> camera1 = new osg::Camera; camera1->setViewMatrix(osg::Matrix::identity());
camera1->setRenderOrder(osg::Camera::POST_RENDER);
camera1->setClearMask(GL_DEPTH_BUFFER_BIT); camera1->setAllowEventFocus(false);
camera1->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera1->setProjectionMatrixAsOrtho2D(-, , -, ); text1->setFont("Fonts/simhei.ttf");
text1->setCharacterSize();
text1->setText(L"OSG 中文字体");
text1->setPosition(osg::Vec3(0.0,0.0,0.0)); geode1->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
geode1->addDrawable(text1); camera1->addChild(geode1.get());
return camera1.release();
} int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
osg::ref_ptr<osg::Group> group1 = new osg::Group; //osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\build20190628.osgb");
osg::ref_ptr<osg::Node> node2 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\build1.osgb"); group1->addChild(node2.get());
group1->addChild(createTextHUD()); viewer1->setSceneData(group1.get());
viewer1->setUpViewInWindow(,,,,); viewer1->run();
}

osgText::Text osg字体的更多相关文章

  1. 【OSG】osgText::Text 研究

    由于需要在3D坐标轴上显示刻度值,所以要用到osgText::Text,这里简单记录一下其常见用法. 一.基本知识 常见设置 设置字体:setFont 设置内容:setText,这里输入参数需要是os ...

  2. osgText::Text简介

    整理自<OpenSceneGraph三维渲染引擎编程指南> 在OSG中,为了显示高质量的文字,专门定义了一个新的名字空间来管理场景中的文字渲染,这个名字空间中的类主要用于加载字体和控制文字 ...

  3. 0312-css样式(选择器、文本text、字体fonts、背景background)

    问题: 1.css中table{border:1px:}是定义table的样式,只有表格的外边框,不能实现<table border="1"></table> ...

  4. css文本样式text、字体样式font

    文本样式text 1.文本颜色color 例如h1 {color:red;} 2.文本方向direction,不常用 默认ltr从左到右,rtl表示从右到左 3.文本水平对齐方式text-align ...

  5. 更换Sublime Text主题字体

    Sublime Text作为脚本程序开发工具是一个不错的选择,支持多种语言,支持代码高亮显示,必要时还有代码提示功能.但是有的主题字体实在是难看,不过Sublime Text中也是可以更改的,只是更改 ...

  6. css 文本外观属性(text) 和 字体样式属性(font)

    css文本 text外观属性 color: 颜色值(red,blue)十六进制 ,rgb letter-spacing: 字间距 px,em word-spacing: 单词间距 对中文无效 line ...

  7. CSS3总结三:文字(text)/字体、文本、文本装饰、多列

    Text-Decoration text-shadow text-decoration Font font font-face Text 常用Text属性 Multi-column Multi-col ...

  8. 第4章 css文字text与字体font-face

    text-overflow 与 word-wrap text-overflow:用来设置是否使用一个省略标记(...)标示对象内文本的溢出. 语法: 但是text-overflow只是用来说明文字溢出 ...

  9. sublime Text 3 字体

    1,Comic Sans Ms 2,DejaVu Sans Mono 3,microsoft yahei(微软雅黑) 4,Microsoft Yahei UI(微软雅黑增强版) 5,Ubuntu Mo ...

随机推荐

  1. LPCXpresso54608开发板中文用户手册

    M11035 LPCXpresso54608/54618/54S618开发板用户手册 1.        简介 LPCXpresso系列电路板为恩智浦LPC Cortex-M系列微控制器提供了强大而灵 ...

  2. leetcode-2-重复的DNA序列

    所有 DNA 都由一系列缩写为 A,C,G 和 T 的核苷酸组成,例如:"ACGAATTCCG".在研究 DNA 时,识别 DNA 中的重复序列有时会对研究非常有帮助. 编写一个函 ...

  3. zstu月赛 招生

    题目 浙江理工大学招生,一开始有0名学生报考,现在有如下几种情况: 1.增加一名报考学生,报考学生成绩为x: 2.一名成绩为x的学生放弃报考. 3.从现在报考的学生来看,老师想知道如果要招生至少x名学 ...

  4. Linux网络编程综合运用之MiniFtp实现(四)

    从今天开始,正式进入MiniFtp的代码编写阶段了,好兴奋,接下来很长一段时间会将整个实现过程从无到有一点点实现出来,达到综合应用的效果,话不多说正入正题: 这节主要是将基础代码框架搭建好,基于上节介 ...

  5. uWSGI ,WSGI和uwsgi的区别

    1.1.为方便理解,uWSGI ,WSGI和uwsgi在网站项目流程图中的功能如下: 1.2.网站项目结构图 2.uWSGI ,WSGI和uwsgi的区别 2.1 WSGI: WSGI,全称 Web ...

  6. jwt的原理以及使用

    jwt原理(json web token) 我们之前是使用session实现登录,通过实际密码+盐组成字符串进行md5存入redis或者数据库中,输入的密码与实际校验通过,发送给客户端一个有效时间的t ...

  7. 多线程下,使用new实现单例

    import threading class Test(object): from threading import Lock lock = Lock() flag = None def __new_ ...

  8. Object.defineProperty 相关学习

    Object.defineProperty 学习   描述: 方法直接在对象上定义一个新属性,或修改对象上的现有属性 并返回该对象.该方法允许精确地添加或修改对象上的属性: 语法: Object.de ...

  9. HTML+CSS基础学习标签代码

    HTML基础 一.HTML页面结构 1.HTML定义 (HTML)为超文本标记语言,是写给浏览器的语言, 目前网络上应用最广泛的语言,目前已经更新到HTML5,HTML添加了一些写的语义化标签,放弃了 ...

  10. hive on spark (spark2.0.0 hive2.3.3)

    hive on spark真的很折腾人啊!!!!!!! 一.软件准备阶段 maven3.3.9 spark2.0.0 hive2.3.3 hadoop2.7.6 二.下载源码spark2.0.0,编译 ...