Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qopenglcontext_platform.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QOPENGLCONTEXT_PLATFORM_H
6#define QOPENGLCONTEXT_PLATFORM_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is part of the native interface APIs. Usage of
13// this API may make your code source and binary incompatible
14// with future versions of Qt.
15//
16
17#ifndef QT_NO_OPENGL
18
19#include <QtGui/qtguiglobal.h>
20#include <QtGui/qopenglcontext.h>
21#include <QtGui/qwindowdefs.h>
22
23#include <QtCore/qnativeinterface.h>
24
25#if defined(Q_OS_MACOS)
26Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLContext);
27#endif
28
29#if QT_CONFIG(xcb_glx_plugin)
30struct __GLXcontextRec; typedef struct __GLXcontextRec *GLXContext;
31#endif
32#if QT_CONFIG(egl)
33typedef void *EGLContext;
34typedef void *EGLDisplay;
35typedef void *EGLConfig;
36#endif
37
38#if !defined(Q_OS_MACOS) && defined(Q_QDOC)
39typedef void *NSOpenGLContext;
40#endif
41
42QT_BEGIN_NAMESPACE
43
44namespace QNativeInterface {
45
46#if defined(Q_OS_MACOS) || defined(Q_QDOC)
47struct Q_GUI_EXPORT QCocoaGLContext
48{
49 QT_DECLARE_NATIVE_INTERFACE(QCocoaGLContext, 1, QOpenGLContext)
50 static QOpenGLContext *fromNative(QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *context, QOpenGLContext *shareContext = nullptr);
51 virtual QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *nativeContext() const = 0;
52};
53#endif
54
55#if defined(Q_OS_WIN) || defined(Q_QDOC)
56struct Q_GUI_EXPORT QWGLContext
57{
58 QT_DECLARE_NATIVE_INTERFACE(QWGLContext, 1, QOpenGLContext)
59 static HMODULE openGLModuleHandle();
60 static QOpenGLContext *fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr);
61 virtual HGLRC nativeContext() const = 0;
62};
63#endif
64
65#if QT_CONFIG(xcb_glx_plugin) || defined(Q_QDOC)
66struct Q_GUI_EXPORT QGLXContext
67{
68 QT_DECLARE_NATIVE_INTERFACE(QGLXContext, 1, QOpenGLContext)
69 static QOpenGLContext *fromNative(GLXContext configBasedContext, QOpenGLContext *shareContext = nullptr);
70 static QOpenGLContext *fromNative(GLXContext visualBasedContext, void *visualInfo, QOpenGLContext *shareContext = nullptr);
71 virtual GLXContext nativeContext() const = 0;
72};
73#endif
74
75#if QT_CONFIG(egl) || defined(Q_QDOC)
76struct Q_GUI_EXPORT QEGLContext
77{
78 QT_DECLARE_NATIVE_INTERFACE(QEGLContext, 1, QOpenGLContext)
79 static QOpenGLContext *fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext = nullptr);
80 virtual EGLContext nativeContext() const = 0;
81 virtual EGLConfig config() const = 0;
82 virtual EGLDisplay display() const = 0;
83
84 virtual void invalidateContext() = 0;
85};
86#endif
87
88} // QNativeInterface
89
90QT_END_NAMESPACE
91
92#endif // QT_NO_OPENGL
93
94#endif // QOPENGLCONTEXT_PLATFORM_H