之前下了一个源码,是在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