File indexing completed on 2025-02-21 10:12:18
0001
0002
0003
0004 #ifndef QOPENGLWINDOW_H
0005 #define QOPENGLWINDOW_H
0006
0007 #include <QtOpenGL/qtopenglglobal.h>
0008
0009 #ifndef QT_NO_OPENGL
0010
0011 #include <QtGui/QPaintDeviceWindow>
0012 #include <QtGui/QOpenGLContext>
0013 #include <QtGui/QImage>
0014
0015 QT_BEGIN_NAMESPACE
0016
0017 class QOpenGLWindowPrivate;
0018
0019 class Q_OPENGL_EXPORT QOpenGLWindow : public QPaintDeviceWindow
0020 {
0021 Q_OBJECT
0022 Q_DECLARE_PRIVATE(QOpenGLWindow)
0023
0024 public:
0025 enum UpdateBehavior {
0026 NoPartialUpdate,
0027 PartialUpdateBlit,
0028 PartialUpdateBlend
0029 };
0030
0031 explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
0032 explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
0033 ~QOpenGLWindow();
0034
0035 UpdateBehavior updateBehavior() const;
0036 bool isValid() const;
0037
0038 void makeCurrent();
0039 void doneCurrent();
0040
0041 QOpenGLContext *context() const;
0042 QOpenGLContext *shareContext() const;
0043
0044 GLuint defaultFramebufferObject() const;
0045
0046 QImage grabFramebuffer();
0047
0048 Q_SIGNALS:
0049 void frameSwapped();
0050
0051 protected:
0052 virtual void initializeGL();
0053 virtual void resizeGL(int w, int h);
0054 virtual void paintGL();
0055 virtual void paintUnderGL();
0056 virtual void paintOverGL();
0057
0058 void paintEvent(QPaintEvent *event) override;
0059 void resizeEvent(QResizeEvent *event) override;
0060 int metric(PaintDeviceMetric metric) const override;
0061 QPaintDevice *redirected(QPoint *) const override;
0062
0063 private:
0064 Q_DISABLE_COPY(QOpenGLWindow)
0065 };
0066
0067 QT_END_NAMESPACE
0068
0069 #endif
0070
0071 #endif