37 lines
638 B
C++
37 lines
638 B
C++
#include <QWindow>
|
|
#include <QOpenGLFunctions>
|
|
|
|
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;
|
|
};
|
|
|