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
qopenglwindow.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 QOPENGLWINDOW_H
6#define QOPENGLWINDOW_H
7
8#include <QtOpenGL/qtopenglglobal.h>
9
10#ifndef QT_NO_OPENGL
11
12#include <QtGui/QPaintDeviceWindow>
13#include <QtGui/QOpenGLContext>
14#include <QtGui/QImage>
15
16QT_BEGIN_NAMESPACE
17
18class QOpenGLWindowPrivate;
19
20class Q_OPENGL_EXPORT QOpenGLWindow : public QPaintDeviceWindow
21{
22 Q_OBJECT
23 Q_DECLARE_PRIVATE(QOpenGLWindow)
24
25public:
26 enum UpdateBehavior {
27 NoPartialUpdate,
28 PartialUpdateBlit,
29 PartialUpdateBlend
30 };
31
32 explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
33 explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
34 ~QOpenGLWindow();
35
36 UpdateBehavior updateBehavior() const;
37 bool isValid() const;
38
39 void makeCurrent();
40 void doneCurrent();
41
42 QOpenGLContext *context() const;
43 QOpenGLContext *shareContext() const;
44
45 GLuint defaultFramebufferObject() const;
46
47 QImage grabFramebuffer();
48
49Q_SIGNALS:
50 void frameSwapped();
51
52protected:
53 virtual void initializeGL();
54 virtual void resizeGL(int w, int h);
55 virtual void paintGL();
56 virtual void paintUnderGL();
57 virtual void paintOverGL();
58
59 void paintEvent(QPaintEvent *event) override;
60 void resizeEvent(QResizeEvent *event) override;
61 int metric(PaintDeviceMetric metric) const override;
62 QPaintDevice *redirected(QPoint *) const override;
63
64private:
65 Q_DISABLE_COPY(QOpenGLWindow)
66};
67
68QT_END_NAMESPACE
69
70#endif // QT_NO_OPENGL
71
72#endif
QOpenGLWindowPaintDevice(QOpenGLWindow *window)
void ensureActiveTarget() override
This virtual method is provided as a callback to allow re-binding a target frame buffer object or con...
QScopedPointer< QOpenGLFramebufferObject > fbo
QScopedPointer< QOpenGLContext > context
QOpenGLTextureBlitter blitter
QScopedPointer< QOpenGLWindowPaintDevice > paintDevice
void endPaint() override
static QOpenGLWindowPrivate * get(QOpenGLWindow *w)
QScopedPointer< QOffscreenSurface > offscreenSurface
void flush(const QRegion &region) override
QOpenGLContext * shareContext
void beginPaint(const QRegion &region) override
\inmodule QtOpenGL
Combined button and popup list for selecting options.
#define GL_DRAW_FRAMEBUFFER
#define GL_READ_FRAMEBUFFER