Files
qad/libs/qglview/openglwindow.h
2022-12-14 14:14:33 +03:00

38 lines
649 B
C++

#include <QOpenGLFunctions>
#include <QWindow>
class QPainter;
class QOpenGLContext;
class QOpenGLPaintDevice;
class OpenGLWindow
: public QWindow
, protected QOpenGLFunctions {
Q_OBJECT
public:
explicit OpenGLWindow(QWindow * parent = nullptr);
~OpenGLWindow();
virtual void render(QPainter * painter);
virtual void render();
virtual void initialize();
QOpenGLContext * context() { return m_context; }
public slots:
void renderLater();
void renderNow();
protected:
bool event(QEvent * event) override;
void exposeEvent(QExposeEvent * event) override;
private:
QOpenGLContext * m_context;
QOpenGLPaintDevice * m_device;
};