十一、OSG学习笔记-操作系统接口

上一章节:

十、OSG学习笔记-多线程(OpenThreads)-CSDN博客https://blog.csdn.net/weixin_36323170/article/details/145813221?spm=1001.2014.3001.5501

本章节代码:

OsgStudy/SysInterFac · CuiQingCheng/OsgStudy - 码云 - 开源中国https://gitee.com/cuiqingcheng/osg-study/tree/master/OsgStudy/SysInterFac

一、操作系接 口渲染流程

下面是一个osg,创建窗口是示例代码:

cpp 复制代码
/**
	运用OSG 创建窗口
**/

#include <windows.h>
#include <iostream>

#include <osgViewer/Viewer>
#include <osgViewer/api/Win32/GraphicsWindowWin32>
#include <osg/GraphicsContext>



int main()
{
	// osgViewer::Viewer, 必须定义,前期准备均在其构造中完成
	osgViewer::Viewer vierer;

	// 窗口信息类
	osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
	traits->x = 100;
	traits->y = 100;
	traits->width = 800;
	traits->height = 800;
	traits->windowDecoration = true;
	traits->doubleBuffer = true;
	traits->sharedContext = 0;

	osgViewer::GraphicsWindowWin32* gw = dynamic_cast<osgViewer::GraphicsWindowWin32*>(osg::GraphicsContext::createGraphicsContext(traits.get()));

	if (gw != nullptr)
	{
		gw->realizeImplementation(); // 创建窗口
		int a;
		std::cin >> a;
	}
	else {
		std::cout << "gw is null" << std::endl;
	}
	return 0;
}

运行结果:

相关推荐
扶尔魔ocy2 天前
【qt openGL入门笔记】OSG实现飞机模型在网格图上飞行并进行态势标绘(四)
qt·opengl·osg
扶尔魔ocy4 天前
【qt openGL入门笔记】OSG实现显示飞机模型飞行的点迹(二)
qt·opengl·osg
扶尔魔ocy4 天前
【qt openGL入门笔记】OSG实现飞机模型在网格图上飞行(三)
opengl·osg
扶尔魔ocy5 天前
【qt openGL入门笔记】OSG实现飞机模型在网格图上飞行
qt·opengl·osg
directx3d_beginner8 个月前
10,cookbook的lod示例
osg
directx3d_beginner8 个月前
8,将0级简模文件和精模文件同时放入pagedlod
osg
directx3d_beginner8 个月前
9,0级建模文件和0级精模文件写成根节点
osg
directx3d_beginner8 个月前
5,保存4个一级节点
osg
directx3d_beginner8 个月前
1, pagedlod和lod
osg
CHPCWWHSU9 个月前
pointCloudExtractor:一个基于 osgPotree 的 Potree 点云数据提取工具
目标识别·osg·potree·点云提取