Files
qglengine/src/core/view/openglwindow.h
peri4 292f68a574 version 1.2.0
fixed framebuffer size feature
2023-05-17 15:58:39 +03:00

48 lines
998 B
C++

#include "qglengine_core_export.h"
#include <QOpenGLExtraFunctions>
#include <QWindow>
class QPainter;
class QOpenGLContext;
class QOpenGLPaintDevice;
class QGLENGINE_CORE_EXPORT OpenGLWindow
: public QWindow
, public QOpenGLExtraFunctions {
Q_OBJECT
public:
explicit OpenGLWindow(QWindow * parent = nullptr);
virtual ~OpenGLWindow() {}
virtual void render() {}
virtual void initialize() {}
QOpenGLContext * context() { return m_context; }
void setVSync(bool on);
bool getVSync() const;
// void setSamples(int samples);
// int getSamples() const;
int getFrameCounter() const { return frame_cnt; }
int pixelWidth() const;
int pixelHeight() const;
QSize pixelSize() const;
QRect pixelRect() const;
public slots:
void renderLater();
void renderNow();
protected:
bool event(QEvent * event) override;
void exposeEvent(QExposeEvent * event) override;
private:
QOpenGLContext * m_context = nullptr;
bool format_change = false;
int frame_cnt = 0;
};