4#ifndef QOPENGLCONTEXT_PLATFORM_H
5#define QOPENGLCONTEXT_PLATFORM_H
18#include <QtGui/qtguiglobal.h>
19#include <QtGui/qopenglcontext.h>
20#include <QtGui/qwindowdefs.h>
22#include <QtCore/qnativeinterface.h>
24#if defined(Q_OS_MACOS)
25Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLContext);
28#if QT_CONFIG(xcb_glx_plugin)
29struct __GLXcontextRec;
typedef struct __GLXcontextRec *GLXContext;
32typedef void *EGLContext;
33typedef void *EGLDisplay;
34typedef void *EGLConfig;
37#if !defined(Q_OS_MACOS) && defined(Q_QDOC)
38typedef void *NSOpenGLContext;
43namespace QNativeInterface {
45#if defined(Q_OS_MACOS) || defined(Q_QDOC)
46struct Q_GUI_EXPORT QCocoaGLContext
48 QT_DECLARE_NATIVE_INTERFACE(QCocoaGLContext, 1, QOpenGLContext)
49 static QOpenGLContext *fromNative(QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *context, QOpenGLContext *shareContext =
nullptr);
50 virtual QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *nativeContext()
const = 0;
54#if defined(Q_OS_WIN) || defined(Q_QDOC)
55struct Q_GUI_EXPORT QWGLContext
57 QT_DECLARE_NATIVE_INTERFACE(QWGLContext, 1, QOpenGLContext)
58 static HMODULE openGLModuleHandle();
59 static QOpenGLContext *fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext =
nullptr);
60 virtual HGLRC nativeContext()
const = 0;
64#if QT_CONFIG(xcb_glx_plugin) || defined(Q_QDOC)
65struct Q_GUI_EXPORT QGLXContext
67 QT_DECLARE_NATIVE_INTERFACE(QGLXContext, 1, QOpenGLContext)
68 static QOpenGLContext *fromNative(GLXContext configBasedContext, QOpenGLContext *shareContext =
nullptr);
69 static QOpenGLContext *fromNative(GLXContext visualBasedContext,
void *visualInfo, QOpenGLContext *shareContext =
nullptr);
70 virtual GLXContext nativeContext()
const = 0;
74#if QT_CONFIG(egl) || defined(Q_QDOC)
75struct Q_GUI_EXPORT QEGLContext
77 QT_DECLARE_NATIVE_INTERFACE(QEGLContext, 1, QOpenGLContext)
78 static QOpenGLContext *fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext =
nullptr);
79 virtual EGLContext nativeContext()
const = 0;
80 virtual EGLConfig config()
const = 0;
81 virtual EGLDisplay display()
const = 0;
83 virtual void invalidateContext() = 0;