#pragma once #include "geometryengine.h" #include #include #include #include #include #include #include #include class GeometryEngine; class OglViewerWidget : public QOpenGLWidget, protected QOpenGLFunctions { Q_OBJECT public: explicit OglViewerWidget(QWidget *parent = 0); ~OglViewerWidget(); protected: void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; void initializeGL() Q_DECL_OVERRIDE; void resizeGL(int w, int h) Q_DECL_OVERRIDE; void paintGL() Q_DECL_OVERRIDE; void initShaders(); void initTextures(); private: struct { bool left = false; bool right = false; QVector2D position; } m_mouse; QOpenGLShaderProgram program; GeometryEngine *geometries; QOpenGLTexture *texture; QMatrix4x4 m_projection; QQuaternion m_rotation; };