Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qplatformopenglcontext.h
Go to the documentation of this file.
1// Copyright (C) 2016 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
4#ifndef QPLATFORMOPENGLCONTEXT_H
5#define QPLATFORMOPENGLCONTEXT_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QPA API and is not meant to be used
12// in applications. Usage of this API may make your code
13// source and binary incompatible with future versions of Qt.
14//
15
16#include <QtGui/qtguiglobal.h>
17#include <QtCore/qnamespace.h>
18
19#ifndef QT_NO_OPENGL
20
21#include <QtGui/qsurfaceformat.h>
22#include <QtGui/qwindow.h>
23#include <QtGui/qopengl.h>
24#include <QtGui/qopenglcontext.h>
25
26#include <QtCore/qnativeinterface.h>
27
29
30
32
33class Q_GUI_EXPORT QPlatformOpenGLContext
34{
35 Q_DECLARE_PRIVATE(QPlatformOpenGLContext)
36public:
39
40 virtual void initialize();
41
42 virtual QSurfaceFormat format() const = 0;
43
44 virtual void swapBuffers(QPlatformSurface *surface) = 0;
45
46 virtual GLuint defaultFramebufferObject(QPlatformSurface *surface) const;
47
48 virtual bool makeCurrent(QPlatformSurface *surface) = 0;
49 virtual void doneCurrent() = 0;
50
51 virtual void beginFrame();
52 virtual void endFrame();
53
54 virtual bool isSharing() const { return false; }
55 virtual bool isValid() const { return true; }
56
57 virtual QFunctionPointer getProcAddress(const char *procName) = 0;
58
59 QOpenGLContext *context() const;
60
61 static bool parseOpenGLVersion(const QByteArray &versionString, int &major, int &minor);
62
63private:
64 friend class QOpenGLContext;
66
67 QScopedPointer<QPlatformOpenGLContextPrivate> d_ptr;
68
69 void setContext(QOpenGLContext *context);
70
71 Q_DISABLE_COPY(QPlatformOpenGLContext)
72};
73
75
76#if defined(Q_OS_MACOS)
77struct Q_GUI_EXPORT QCocoaGLIntegration
78{
79 QT_DECLARE_NATIVE_INTERFACE(QCocoaGLIntegration)
80 virtual QOpenGLContext *createOpenGLContext(NSOpenGLContext *, QOpenGLContext *shareContext) const = 0;
81};
82#endif
83
84#if defined(Q_OS_WIN)
85struct Q_GUI_EXPORT QWindowsGLIntegration
86{
87 QT_DECLARE_NATIVE_INTERFACE(QWindowsGLIntegration)
88 virtual HMODULE openGLModuleHandle() const = 0;
89 virtual QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, QOpenGLContext *shareContext) const = 0;
90};
91#endif
92
93#if QT_CONFIG(xcb_glx_plugin)
94struct Q_GUI_EXPORT QGLXIntegration
95{
96 QT_DECLARE_NATIVE_INTERFACE(QGLXIntegration)
97 virtual QOpenGLContext *createOpenGLContext(GLXContext context, void *visualInfo, QOpenGLContext *shareContext) const = 0;
98};
99#endif
100
101#if QT_CONFIG(egl)
102struct Q_GUI_EXPORT QEGLIntegration
103{
104 QT_DECLARE_NATIVE_INTERFACE(QEGLIntegration)
105 virtual QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const = 0;
106};
107#endif
108
109} // QNativeInterface::Private
110
112
113#endif // QT_NO_OPENGL
114
115#endif // QPLATFORMOPENGLCONTEXT_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtGui
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
virtual QSurfaceFormat format() const =0
virtual bool makeCurrent(QPlatformSurface *surface)=0
virtual bool isSharing() const
virtual void swapBuffers(QPlatformSurface *surface)=0
Reimplement in subclass to native swap buffers calls.
virtual void doneCurrent()=0
virtual QFunctionPointer getProcAddress(const char *procName)=0
Reimplement in subclass to allow dynamic querying of OpenGL symbols.
virtual bool isValid() const
The QPlatformSurface class provides an abstraction for a surface.
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
static void * context
static bool initialize()
Definition qctf.cpp:94
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
#define QT_DECLARE_NATIVE_INTERFACE(...)
#define GLuint
HINSTANCE HMODULE
aWidget window() -> setWindowTitle("New Window Title")
[2]