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
qopenglcompositor_p.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
4#ifndef QOPENGLCOMPOSITOR_H
5#define QOPENGLCOMPOSITOR_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtOpenGL/qtopenglglobal.h>
19
20#include <QtCore/QTimer>
21#include <QtOpenGL/QOpenGLTextureBlitter>
22#include <QtGui/QMatrix4x4>
23#include <QtCore/private/qglobal_p.h>
24
26
27class QOpenGLContext;
29class QWindow;
31
34{
35public:
37 virtual QWindow *sourceWindow() const = 0;
38 virtual const QPlatformTextureList *textures() const = 0;
39 virtual void beginCompositing() { }
40 virtual void endCompositing() { }
43};
44
45class Q_OPENGL_EXPORT QOpenGLCompositor : public QObject
46{
48
49public:
54
55 static QOpenGLCompositor *instance();
56 static void destroy();
57
58 void setTargetWindow(QWindow *window, const QRect &nativeTargetGeometry);
59 void setTargetContext(QOpenGLContext *context);
60 void setRotation(int degrees);
61 QOpenGLContext *context() const { return m_context; }
62 QWindow *targetWindow() const { return m_targetWindow; }
63 QRect nativeTargetGeometry() const { return m_nativeTargetGeometry; }
64
65 void update();
66 QImage grab();
67
68 bool grabToFrameBufferObject(QOpenGLFramebufferObject *fbo, GrabOrientation orientation = Flipped);
69
70 QList<QOpenGLCompositorWindow *> windows() const { return m_windows; }
71 void addWindow(QOpenGLCompositorWindow *window);
72 void removeWindow(QOpenGLCompositorWindow *window);
73 void moveToTop(QOpenGLCompositorWindow *window);
74 void changeWindowIndex(QOpenGLCompositorWindow *window, int newIdx);
75
78
79private slots:
80 void handleRenderAllRequest();
81
82private:
85
86 void renderAll(QOpenGLFramebufferObject *fbo,
90 void ensureCorrectZOrder();
91
92 QOpenGLContext *m_context;
93 QWindow *m_targetWindow;
94 QRect m_nativeTargetGeometry;
95 int m_rotation;
96 QMatrix4x4 m_rotationMatrix;
97 QTimer m_updateTimer;
98 QOpenGLTextureBlitter m_blitter;
99 QList<QOpenGLCompositorWindow *> m_windows;
100};
101
103
104#endif // QOPENGLCOMPOSITOR_H
\inmodule QtGui
Definition qimage.h:37
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtCore
Definition qobject.h:103
A backing store implementation for OpenGL.
virtual QOpenGLCompositorBackingStore * backingStore() const =0
virtual const QPlatformTextureList * textures() const =0
virtual QWindow * sourceWindow() const =0
virtual void setBackingStore(QOpenGLCompositorBackingStore *backingStore)=0
A generic OpenGL-based compositor.
QRect nativeTargetGeometry() const
QOpenGLContext * context() const
QList< QOpenGLCompositorWindow * > windows() const
QWindow * targetWindow() const
void topWindowChanged(QOpenGLCompositorWindow *window)
\inmodule QtGui
The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.
The QOpenGLTextureBlitter class provides a convenient way to draw textured quads via OpenGL.
Origin
\value OriginBottomLeft Indicates that the data in the texture follows the OpenGL convention of coord...
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qtimer.h:20
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
static void * context
#define Q_OBJECT
#define slots
#define signals
aWidget window() -> setWindowTitle("New Window Title")
[2]
myWidget render(this)