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
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// Qt-Security score:significant reason:default
4
5#ifndef QPLATFORMOPENGLCONTEXT_H
6#define QPLATFORMOPENGLCONTEXT_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is part of the QPA API and is not meant to be used
13// in applications. Usage of this API may make your code
14// source and binary incompatible with future versions of Qt.
15//
16
17#include <QtGui/qtguiglobal.h>
18#include <QtCore/qnamespace.h>
19
20#ifndef QT_NO_OPENGL
21
22#include <QtGui/qsurfaceformat.h>
23#include <QtGui/qwindow.h>
24#include <QtGui/qopengl.h>
25#include <QtGui/qopenglcontext.h>
26
27#include <QtCore/qnativeinterface.h>
28
29QT_BEGIN_NAMESPACE
30
31
32class QPlatformOpenGLContextPrivate;
33
34class Q_GUI_EXPORT QPlatformOpenGLContext
35{
36 Q_DECLARE_PRIVATE(QPlatformOpenGLContext)
37public:
38 QPlatformOpenGLContext();
39 virtual ~QPlatformOpenGLContext();
40
41 virtual void initialize();
42
43 virtual QSurfaceFormat format() const = 0;
44
45 virtual void swapBuffers(QPlatformSurface *surface) = 0;
46
47 virtual GLuint defaultFramebufferObject(QPlatformSurface *surface) const;
48
49 virtual bool makeCurrent(QPlatformSurface *surface) = 0;
50 virtual void doneCurrent() = 0;
51
52 virtual void beginFrame();
53 virtual void endFrame();
54
55 virtual bool isSharing() const { return false; }
56 virtual bool isValid() const { return true; }
57
58 virtual QFunctionPointer getProcAddress(const char *procName) = 0;
59
60 QOpenGLContext *context() const;
61
62 static bool parseOpenGLVersion(const QByteArray &versionString, int &major, int &minor);
63
64private:
65 friend class QOpenGLContext;
67
68 QScopedPointer<QPlatformOpenGLContextPrivate> d_ptr;
69
70 void setContext(QOpenGLContext *context);
71
73};
74
75namespace QNativeInterface::Private {
76
77#if defined(Q_OS_MACOS)
79{
82};
83#endif
84
85#if defined(Q_OS_WIN)
87{
89 virtual HMODULE openGLModuleHandle() const = 0;
91};
92#endif
93
94#if QT_CONFIG(xcb_glx_plugin)
96{
99};
100#endif
101
102#if QT_CONFIG(egl)
104{
107};
108#endif
109
110} // QNativeInterface::Private
111
112QT_END_NAMESPACE
113
114#endif // QT_NO_OPENGL
115
116#endif // QPLATFORMOPENGLCONTEXT_H
QByteArray format() const
Returns the format QImageReader uses for reading images.
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
virtual void initialize()
Called after a new instance is constructed.
virtual QFunctionPointer getProcAddress(const char *procName)=0
Reimplement in subclass to allow dynamic querying of OpenGL symbols.
virtual void swapBuffers(QPlatformSurface *surface)=0
Reimplement in subclass to native swap buffers calls.
virtual bool makeCurrent(QPlatformSurface *surface)=0
virtual bool isSharing() const
virtual void doneCurrent()=0
QOpenGLContext * context() const
virtual void endFrame()
Called when the RHI ends rendering a in the context.
virtual GLuint defaultFramebufferObject(QPlatformSurface *surface) const
Reimplement in subclass if your platform uses framebuffer objects for surfaces.
virtual void beginFrame()
Called when the RHI begins rendering a new frame in the context.
virtual bool isValid() const
static bool parseOpenGLVersion(const QByteArray &versionString, int &major, int &minor)
Combined button and popup list for selecting options.