#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. vue + jenkins 自动部署到指定的目录

    1. 首先选择自由风的构建方式 2. 我的源码在gitlab上,在源码管理下,提供仓库URL和凭证,以及gitlab的分支 3. 在构建环境下选择提供Node &npm bin/folder ...

  2. Plot the figure of K-SVCR

    clear %% generate data prettySpiral = 0; if ~prettySpiral % generate some random gaussian like data ...

  3. Eclipse修改项目jdk版本

    修改项目jdk版本(@Override的解决方法) (1)Eclipse的Window-Preferences->Java->Compiler(2)Eclipse的Project-> ...

  4. linux网络编程之共享内存介绍

    今天是个好日子,洋人之节乃全球同庆,圣诞一来感觉就要过年了,不过今晚心情有点打折扣,给心爱的人打电话没有打通,本想在平安夜送上快乐的祝福给她,糟糕的心情让自己好像泄了气的皮球一样,无精打彩,心情灰暗, ...

  5. Oracle之约束

    数据的完整性用于确保数据库数据遵从一定的商业的逻辑规则.在oracle中,数据完整性可以使用约束.触发器.应用程序(过程.函数)三种方法来实现,在这三种方法中,因为约束易于维护,并且具有最好的性能,所 ...

  6. CentOS7下rabbitmq的详细安装教程

    一.安装前的准备工作:[rabbitmq下载] rabbitmq下载官网地址:http://www.rabbitmq.com/ 具体的安装包的下载[这里安装的版本是3.7.5]:https://git ...

  7. C#经纬度加减运算(度°分′秒″格式)

    经度是分和秒是按60进位,如果要做运算第一步就是转换成浮点数,之后就是计算和还原. using System.Text.RegularExpressions; public static double ...

  8. git merge 及 git rebase的区别

    Git上合并代码有git merge 及 git rebase 两种方式. 前置知识点 Master分支:首先,代码库应该有一个.且仅有一个主分支.所有提供给用户使用的正式版本,都在这个主分支上发布. ...

  9. Jquery Datepicker DateTimepicker

    1.Datepicker http://jqueryui.com/datepicker/ 2.DateTimepicker jquery-ui-timepicker-addon.js http://w ...

  10. TensorFlow(一):准备

    我的环境:win10+python3.6.4(64位) 一:安装python 根据自己的电脑下载python(32位或者64位)-->安装教程 安装好python后记得配置pip源,使用官方的源 ...