You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.2 KiB

#ifndef __OPEN_GL_WIDGET_HEADER__
#define __OPEN_GL_WIDGET_HEADER__
#include "../guiClass.h"
#include <QtWidgets/QOpenGLWidget>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLBuffer>
#include <QtGui/QVector3D>
#include <QtGui/QMatrix4x4>
#include <QtCore/QTime>
#include <QtCore/QVector>
#include <QtWidgets/QPushButton>
//class Bubble;
class MainWindow;
//QT_FORWARD_DECLARE_CLASS(QOpenGLTexture)
//QT_FORWARD_DECLARE_CLASS(QOpenGLShader)
//QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
//Q_OBJECT
public:
GLWidget(MainWindow *mw, bool button, const QColor &background);
~GLWidget();
public slots:
void setScaling(int scale);
void setLogo();
void setTexture();
void setShowBubbles(bool);
void setTransparent(bool transparent);
private slots:
void handleButtonPress();
protected:
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
void initializeGL() Q_DECL_OVERRIDE;
private:
void paintTexturedCube();
void paintQtLogo();
void createGeometry();
//void createBubbles(int number);
void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4);
void extrude(qreal x1, qreal y1, qreal x2, qreal y2);
MainWindow *m_mainWindow;
qreal m_fAngle;
qreal m_fScale;
//bool m_showBubbles;
QVector<QVector3D> m_vertices;
QVector<QVector3D> m_normals;
bool m_qtLogo;
//QList<Bubble *> m_bubbles;
int m_frames;
QTime m_time;
QOpenGLShader *m_vshader1;
QOpenGLShader *m_fshader1;
QOpenGLShader *m_vshader2;
QOpenGLShader *m_fshader2;
QOpenGLShaderProgram *m_program1;
QOpenGLShaderProgram *m_program2;
QOpenGLTexture *m_texture;
QOpenGLBuffer m_vbo1;
QOpenGLBuffer m_vbo2;
int m_vertexAttr1;
int m_normalAttr1;
int m_matrixUniform1;
int m_vertexAttr2;
int m_normalAttr2;
int m_texCoordAttr2;
int m_matrixUniform2;
int m_textureUniform2;
bool m_transparent;
QPushButton *m_btn;
bool m_hasButton;
QColor m_background;
};
#endif