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
4#ifndef QOPENGLWINDOW_H
5#define QOPENGLWINDOW_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#ifndef QT_NO_OPENGL
10
11#include <QtGui/QPaintDeviceWindow>
12#include <QtGui/QOpenGLContext>
13#include <QtGui/QImage>
14
15QT_BEGIN_NAMESPACE
16
17class QOpenGLWindowPrivate;
18
19class Q_OPENGL_EXPORT QOpenGLWindow : public QPaintDeviceWindow
20{
21 Q_OBJECT
22 Q_DECLARE_PRIVATE(QOpenGLWindow)
23
24public:
25 enum UpdateBehavior {
26 NoPartialUpdate,
27 PartialUpdateBlit,
28 PartialUpdateBlend
29 };
30
31 explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
32 explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
33 ~QOpenGLWindow();
34
35 UpdateBehavior updateBehavior() const;
36 bool isValid() const;
37
38 void makeCurrent();
39 void doneCurrent();
40
41 QOpenGLContext *context() const;
42 QOpenGLContext *shareContext() const;
43
44 GLuint defaultFramebufferObject() const;
45
46 QImage grabFramebuffer();
47
48Q_SIGNALS:
49 void frameSwapped();
50
51protected:
52 virtual void initializeGL();
53 virtual void resizeGL(int w, int h);
54 virtual void paintGL();
55 virtual void paintUnderGL();
56 virtual void paintOverGL();
57
58 void paintEvent(QPaintEvent *event) override;
59 void resizeEvent(QResizeEvent *event) override;
60 int metric(PaintDeviceMetric metric) const override;
61 QPaintDevice *redirected(QPoint *) const override;
62
63private:
64 Q_DISABLE_COPY(QOpenGLWindow)
65};
66
67QT_END_NAMESPACE
68
69#endif // QT_NO_OPENGL
70
71#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