19#include <QOpenGLContext>
28#include <simgear/compiler.h>
32#elif defined(SG_WINDOWS)
33# include <QtPlatformHeaders/QWGLNativeContext>
34# include <osgViewer/api/Win32/GraphicsWindowWin32>
37# include <osgViewer/api/X11/GraphicsWindowX11>
38# include <QtPlatformHeaders/QGLXNativeContext>
48#elif defined(SG_WINDOWS)
53 auto win =
dynamic_cast<osgViewer::GraphicsWindowWin32*
>(context);
58 auto wglnc = QWGLNativeContext{win->getWGLContext(), win->getHWND()};
59 QVariant nativeHandle = QVariant::fromValue(wglnc);
61 if (nativeHandle.isNull())
64 std::unique_ptr<QOpenGLContext> qtOpenGLContext(
new QOpenGLContext);
65 qtOpenGLContext->setNativeHandle(nativeHandle);
66 if (!qtOpenGLContext->create()) {
70 return qtOpenGLContext.release();
75 auto win =
dynamic_cast<osgViewer::GraphicsWindowWin32*
>(graphicsWindow);
80 return QWindow::fromWinId(
reinterpret_cast<qlonglong
>(win->getHWND()));
89 auto win =
dynamic_cast<osgViewer::GraphicsWindowX11*
>(context);
94 auto glxnc = QGLXNativeContext{win->getContext(), win->getDisplay(), win->getWindow(), 0};
95 QVariant nativeHandle = QVariant::fromValue(glxnc);
97 if (nativeHandle.isNull())
100 std::unique_ptr<QOpenGLContext> qtOpenGLContext(
new QOpenGLContext);
101 qtOpenGLContext->setNativeHandle(nativeHandle);
102 if (!qtOpenGLContext->create()) {
106 return qtOpenGLContext.release();
111 auto win =
dynamic_cast<osgViewer::GraphicsWindowX11*
>(graphicsWindow);
116 return QWindow::fromWinId(
static_cast<qlonglong
>(win->getWindow()));
125 osg::GraphicsOperation(
name, false),
142 osg::ref_ptr<osg::GraphicsOperation> r;
GraphicsFunctorWrapper(const std::string &name, GraphicsFunctor gf)
void operator()(osg::GraphicsContext *gc) override
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
QWindow * qtWindowFromOSG(osgViewer::GraphicsWindow *graphicsWindow)
osg::ref_ptr< osg::GraphicsOperation > makeGraphicsOp(const std::string &name, GraphicsFunctor func)
QOpenGLContext * qtContextFromOSG(osg::GraphicsContext *context)
std::function< void(osg::GraphicsContext *context)> GraphicsFunctor