C++学习(四四五)GraphicsWindowEmbedded为什么没有窗体接口
Posted hankern
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++学习(四四五)GraphicsWindowEmbedded为什么没有窗体接口相关的知识,希望对你有一定的参考价值。
缺少类似于Win32的
static osg::WindowingSystemInterfaceProxy<Win32WindowingSystem> s_proxy_Win32WindowingSystem("Win32");
osg/GraphicsContext
template<class T>
struct WindowingSystemInterfaceProxy
WindowingSystemInterfaceProxy(const std::string& name)
_wsi = new T;
_wsi->setName(name);
osg::GraphicsContext::getWindowingSystemInterfaces()->addWindowingSystemInterface(_wsi.get());
~WindowingSystemInterfaceProxy()
osg::GraphicsContext::getWindowingSystemInterfaces()->removeWindowingSystemInterface(_wsi.get());
osg::ref_ptr<T> _wsi;
;
可以自定义一个接口
class EmbeddedWindowingSystem : public osg::GraphicsContext::WindowingSystemInterface
public:
osg::GraphicsContext *createGraphicsContext(osg::GraphicsContext::Traits *traits) override
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> window = new osgViewer::GraphicsWindowEmbedded(traits);
if (window->valid()) return window.release();
else return 0;
unsigned int
getNumScreens(const osg::GraphicsContext::ScreenIdentifier &screenIdentifier) override
return 0;
void getScreenSettings(const osg::GraphicsContext::ScreenIdentifier &screenIdentifier,
osg::GraphicsContext::ScreenSettings &resolution) override
void enumerateScreenSettings(const osg::GraphicsContext::ScreenIdentifier &screenIdentifier,
osg::GraphicsContext::ScreenSettingsList &resolutionList) override
;
通过如下语句注册该窗体接口
osg::GraphicsContext::getWindowingSystemInterfaces()->addWindowingSystemInterface(new EmbeddedWindowingSystem());
以上是关于C++学习(四四五)GraphicsWindowEmbedded为什么没有窗体接口的主要内容,如果未能解决你的问题,请参考以下文章