结合Win32和OSG窗口

2023-12-23 06:55:38

之前下了一个源码,是在MFC中展示OSG窗口,窗口出来总有一个黑色阴影;

下面单独看一下把osg窗口做到win32窗口中的情况;

#include <windows.h>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/api/win32/GraphicsWindowWin32>
#include <osgUtil/Optimizer>
#include <osgGA/TrackballManipulator>
#include <osgDB/ReadFile>
#include <process.h>

osg::ref_ptr<osgViewer::Viewer> viewer;
osg::observer_ptr<osgViewer::GraphicsWindow> window;
osg::ref_ptr<osg::Group> root;
osg::ref_ptr<osg::Node> loadedModel;
osgUtil::Optimizer optimizer;
osg::ref_ptr<osg::GraphicsContext::Traits> traits;
osg::ref_ptr<osg::Referenced> windata;
osg::GraphicsContext* gc;
osg::ref_ptr<osg::Camera> camera;
bool renderok;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	sta

文章来源:https://blog.csdn.net/bcbobo21cn/article/details/135162759
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。