summaryrefslogtreecommitdiffstats
path: root/src/platformheaders/nativecontexts
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformheaders/nativecontexts')
-rw-r--r--src/platformheaders/nativecontexts/nativecontexts.pri4
-rw-r--r--src/platformheaders/nativecontexts/qcocoanativecontext.h70
-rw-r--r--src/platformheaders/nativecontexts/qcocoanativecontext.qdoc58
-rw-r--r--src/platformheaders/nativecontexts/qeglnativecontext.h74
-rw-r--r--src/platformheaders/nativecontexts/qeglnativecontext.qdoc64
-rw-r--r--src/platformheaders/nativecontexts/qglxnativecontext.h83
-rw-r--r--src/platformheaders/nativecontexts/qglxnativecontext.qdoc83
-rw-r--r--src/platformheaders/nativecontexts/qwglnativecontext.h76
-rw-r--r--src/platformheaders/nativecontexts/qwglnativecontext.qdoc131
9 files changed, 643 insertions, 0 deletions
diff --git a/src/platformheaders/nativecontexts/nativecontexts.pri b/src/platformheaders/nativecontexts/nativecontexts.pri
new file mode 100644
index 0000000000..cfb190e4fa
--- /dev/null
+++ b/src/platformheaders/nativecontexts/nativecontexts.pri
@@ -0,0 +1,4 @@
+HEADERS += $$PWD/qglxnativecontext.h \
+ $$PWD/qeglnativecontext.h \
+ $$PWD/qcocoanativecontext.h \
+ $$PWD/qwglnativecontext.h
diff --git a/src/platformheaders/nativecontexts/qcocoanativecontext.h b/src/platformheaders/nativecontexts/qcocoanativecontext.h
new file mode 100644
index 0000000000..34994089c4
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qcocoanativecontext.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the plugins of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QCOCOANATIVECONTEXT_H
+#define QCOCOANATIVECONTEXT_H
+
+#include <QtCore/QMetaType>
+#include <AppKit/NSOpenGL.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QCocoaNativeContext
+{
+ QCocoaNativeContext()
+ : m_context(0)
+ { }
+
+ QCocoaNativeContext(NSOpenGLContext *ctx)
+ : m_context(ctx)
+ { }
+
+ NSOpenGLContext *context() const { return m_context; }
+
+private:
+ NSOpenGLContext *m_context;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QCocoaNativeContext)
+
+#endif // QCOCOANATIVECONTEXT_H
diff --git a/src/platformheaders/nativecontexts/qcocoanativecontext.qdoc b/src/platformheaders/nativecontexts/qcocoanativecontext.qdoc
new file mode 100644
index 0000000000..96b33ce5f8
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qcocoanativecontext.qdoc
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QCocoaNativeContext
+ \inmodule QtPlatformHeaders
+ \since 5.4
+
+ \brief A class encapsulating a Cocoa NSOpenGLContext.
+
+ \note There is no binary compatibility guarantee for this class, meaning
+ that an application using it is only guaranteed to work with the Qt version it was
+ developed against.
+
+ \sa QOpenGLContext::setNativeHandle(), QOpenGLContext::nativeHandle()
+ */
+
+/*!
+ \fn NSOpenGLContext *QCocoaNativeContext::context() const
+
+ \return the context.
+ */
+
+/*!
+ \fn QCocoaNativeContext::QCocoaNativeContext()
+
+ Construct a new instance with no handles.
+ */
+
+/*!
+ \fn QCocoaNativeContext::QCocoaNativeContext(NSOpenGLContext *ctx)
+
+ Constructs a new instance with the provided \a ctx handle.
+ */
diff --git a/src/platformheaders/nativecontexts/qeglnativecontext.h b/src/platformheaders/nativecontexts/qeglnativecontext.h
new file mode 100644
index 0000000000..a2411419ef
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qeglnativecontext.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QEGLNATIVECONTEXT_H
+#define QEGLNATIVECONTEXT_H
+
+#include <QtCore/QMetaType>
+#include <EGL/egl.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QEGLNativeContext
+{
+ QEGLNativeContext()
+ : m_context(0),
+ m_display(0)
+ { }
+
+ QEGLNativeContext(EGLContext ctx, EGLDisplay dpy)
+ : m_context(ctx),
+ m_display(dpy)
+ { }
+
+ EGLContext context() const { return m_context; }
+ EGLDisplay display() const { return m_display; }
+
+private:
+ EGLContext m_context;
+ EGLDisplay m_display;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QEGLNativeContext)
+
+#endif // QEGLNATIVECONTEXT_H
diff --git a/src/platformheaders/nativecontexts/qeglnativecontext.qdoc b/src/platformheaders/nativecontexts/qeglnativecontext.qdoc
new file mode 100644
index 0000000000..edadbdfa83
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qeglnativecontext.qdoc
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QEGLNativeContext
+ \inmodule QtPlatformHeaders
+ \since 5.4
+
+ \brief A class encapsulating an EGL context and display handle
+
+ \note There is no binary compatibility guarantee for this class, meaning
+ that an application using it is only guaranteed to work with the Qt version it was
+ developed against.
+
+ \sa QOpenGLContext::setNativeHandle(), QOpenGLContext::nativeHandle()
+ */
+
+/*!
+ \fn EGLContext QEGLNativeContext::context() const
+
+ \return the EGL context.
+ */
+
+/*!
+ \fn EGLDisplay QEGLNativeContext::display() const
+
+ \return the EGL display.
+ */
+
+/*!
+ \fn QEGLNativeContext::QEGLNativeContext()
+
+ Construct a new instance with no handles.
+ */
+
+/*!
+ \fn QEGLNativeContext::QEGLNativeContext(EGLContext ctx, EGLDisplay dpy)
+
+ Constructs a new instance with the provided \a ctx and \a dpy handles.
+ */
diff --git a/src/platformheaders/nativecontexts/qglxnativecontext.h b/src/platformheaders/nativecontexts/qglxnativecontext.h
new file mode 100644
index 0000000000..21ae334c25
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qglxnativecontext.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGLXNATIVECONTEXT_H
+#define QGLXNATIVECONTEXT_H
+
+#include <QtCore/QMetaType>
+#include <X11/Xlib.h>
+#include <GL/glx.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QGLXNativeContext
+{
+ QGLXNativeContext()
+ : m_context(0),
+ m_display(0),
+ m_window(0),
+ m_visualId(0)
+ { }
+
+ QGLXNativeContext(GLXContext ctx, Display *dpy = 0, Window wnd = 0, VisualID vid = 0)
+ : m_context(ctx),
+ m_display(dpy),
+ m_window(wnd),
+ m_visualId(vid)
+ { }
+
+ GLXContext context() const { return m_context; }
+ Display *display() const { return m_display; }
+ Window window() const { return m_window; }
+ VisualID visualId() const { return m_visualId; }
+
+private:
+ GLXContext m_context;
+ Display *m_display;
+ Window m_window;
+ VisualID m_visualId;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QGLXNativeContext)
+
+#endif // QGLXNATIVECONTEXT_H
diff --git a/src/platformheaders/nativecontexts/qglxnativecontext.qdoc b/src/platformheaders/nativecontexts/qglxnativecontext.qdoc
new file mode 100644
index 0000000000..81f3c0b2ca
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qglxnativecontext.qdoc
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QGLXNativeContext
+ \inmodule QtPlatformHeaders
+ \since 5.4
+
+ \brief A class encapsulating a GLXContext and related native handles.
+
+ \note Only context() is guaranteed to be valid. The other handles may be all \c 0. They are
+ useful however when QOpenGLContext::setNativeHandle() is used to adopt a legacy context
+ created by glXCreateContext. To adopt such a context, either the Window or VisualID
+ that had been used to create the context needs to be known, otherwise the adoption will
+ fail. For modern contexts created with an FBConfig, these are not necessary, the
+ GLXContext itself is sufficient. The Display is optional.
+
+ \note There is no binary compatibility guarantee for this class, meaning
+ that an application using it is only guaranteed to work with the Qt version it was
+ developed against.
+
+ \sa QOpenGLContext::setNativeHandle(), QOpenGLContext::nativeHandle()
+ */
+
+/*!
+ \fn GLXContext QGLXNativeContext::context() const
+
+ \return the GLXContext.
+ */
+
+/*!
+ \fn Display *QGLXNativeContext::display() const
+
+ \return a pointer to the X11 display or \c NULL if not available.
+ */
+
+/*!
+ \fn Window QGLXNativeContext::window() const
+
+ \return the X11 Window or \c 0 if not available.
+ */
+
+/*!
+ \fn VisualID QGLXNativeContext::visualId() const
+
+ \return the X11 visual ID or \c 0 if not available.
+ */
+
+/*!
+ \fn QGLXNativeContext::QGLXNativeContext()
+
+ Construct a new instance with no handles.
+ */
+
+/*!
+ \fn QGLXNativeContext::QGLXNativeContext(GLXContext ctx, Display *dpy = 0, Window wnd = 0, VisualID vid = 0)
+
+ Constructs a new instance with the provided \a ctx, \a dpy, \a wnd, \a vid handles.
+ */
diff --git a/src/platformheaders/nativecontexts/qwglnativecontext.h b/src/platformheaders/nativecontexts/qwglnativecontext.h
new file mode 100644
index 0000000000..4a68633703
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qwglnativecontext.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWGLNATIVECONTEXT_H
+#define QWGLNATIVECONTEXT_H
+
+#include <QtCore/QMetaType>
+#include <wingdi.h>
+#include <GL/gl.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWGLNativeContext
+{
+public:
+ QWGLNativeContext()
+ : m_context(0),
+ m_window(0)
+ { }
+
+ QWGLNativeContext(HGLRC ctx, HWND wnd)
+ : m_context(ctx),
+ m_window(wnd)
+ { }
+
+ HGLRC context() const { return m_context; }
+ HWND window() const { return m_window; }
+
+private:
+ HGLRC m_context;
+ HWND m_window;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QWGLNativeContext)
+
+#endif // QWGLNATIVECONTEXT_H
diff --git a/src/platformheaders/nativecontexts/qwglnativecontext.qdoc b/src/platformheaders/nativecontexts/qwglnativecontext.qdoc
new file mode 100644
index 0000000000..86ae291aaa
--- /dev/null
+++ b/src/platformheaders/nativecontexts/qwglnativecontext.qdoc
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QWGLNativeContext
+ \inmodule QtPlatformHeaders
+ \since 5.4
+
+ \brief A class encapsulating a WGL context on Windows with desktop OpenGL (opengl32.dll)
+
+ \note There is no binary compatibility guarantee for this class,
+ meaning that an application using it is only guaranteed to work with the Qt
+ version it was developed against.
+
+ QWGLNativeContext is a value class that can be passed to
+ QOpenGLContext::setNativeHandle(). When creating a QOpenGLContext with the
+ native handle set, no new context will get created. Instead, the provided
+ handles are used, without taking ownership. This allows wrapping a context
+ created by an external framework or rendering engine. The typical usage will
+ be similar to the following snippet:
+
+ \code
+ #include <QtPlatformSupport/QWGLNativeContext>
+ ...create and retrieve the WGL context and the corresponding window...
+ QOpenGLContext *context = new QOpenGLContext;
+ QWGLNativeContext nativeContext(hglrc, hwnd);
+ context->setNativeHandle(QVariant::fromValue(nativeContext));
+ context->create();
+ ...
+ \endcode
+
+ The window is needed because the its pixel format will be queried. When the
+ adoption is successful, QOpenGLContext::format() will return a QSurfaceFormat
+ describing this pixel format.
+
+ It is recommended to restrict the usage of QOpenGLContexts created this way.
+ Various platform-specific behavior and issues may prevent such contexts to be
+ made current with windows (surfaces) created by Qt due to non-matching pixel
+ formats for example. A potentially safer solution is to use the wrapped
+ context only to set up sharing and perform Qt-based rendering offscreen,
+ using a separate, dedicated QOpenGLContext. The resulting textures are then
+ accessible in the foreign context too.
+
+ \code
+ ...like above...
+ QOpenGLContext *qtcontext = new QOpenGLContext;
+ qtcontext->setShareContext(context);
+ qtcontext->setFormat(context->format());
+ qtcontext->create();
+ ...use qtcontext for rendering with Qt...
+ \endcode
+
+ In addition to being used with QOpenGLContext::setNativeHandle(), this class
+ is used also to retrieve the native context handle, that is, a HGLRC value,
+ from a QOpenGLContext. Calling QOpenGLContext::nativeHandle() returns a
+ QVariant which, on Windows with opengl32.dll at least, will contain a
+ QWGLNativeContext:
+
+ \code
+ QVariant nativeHandle = context->nativeHandle();
+ if (!nativeHandle.isNull() && nativeHandle.canConvert<QWGLNativeContext>()) {
+ QWGLNativeContext nativeContext = nativeHandle.value<QWGLNativeContext>();
+ HGLRC hglrc = nativeContext.context();
+ ...
+ }
+ \endcode
+
+ \sa QOpenGLContext::setNativeHandle(), QOpenGLContext::nativeHandle()
+ */
+
+/*!
+ \fn HGLRC QWGLNativeContext::context() const
+
+ \return the WGL context.
+ */
+
+/*!
+ \fn HWND QWGLNativeContext::window() const
+
+ \note The window handle is not available when the QWGLNativeContext is
+ queried from a regular, non-adopted QOpenGLContext using
+ QOpenGLContext::nativeHandle(). This is because the \e windows platform
+ plugin creates WGL contexts using a dummy window that is not available
+ afterwards. Instead, the native window handle (HWND) is queriable from a
+ QWindow via QPlatformNativeInterface::nativeResourceForWindow() using the \e
+ "handle" resource key. Note however that the window will not have its pixel
+ format set until it is first associated with a context via
+ QOpenGLContext::makeCurrent().
+
+ \return handle for the window for which the context was created.
+ */
+
+/*!
+ \fn QWGLNativeContext::QWGLNativeContext()
+
+ Construct a new instance with no handles.
+ */
+
+/*!
+ \fn QWGLNativeContext::QWGLNativeContext(HGLRC ctx, HWND wnd)
+
+ Constructs a new instance with the provided \a ctx context handle and \a wnd window handle.
+
+ \note The window specified by \a wnd must have its pixel format set to a
+ format compatible with the context's. If no SetPixelFormat() call was made on
+ any device context belonging to the window, adopting the context will fail.
+ */