I believe the correct way to use the QOpenGLFunction_3_1 class is actually to use protected inheritance, so that it's members are pulled into class scope and we can avoid the 'gl->' prefix. At least, this is the recommended approach for QOpenGLFunctions (http://qt-project.org/doc/qt-5/qopenglfunctions.html#details)

This commit is contained in:
David Williams
2014-03-25 21:53:14 +01:00
parent 1f1cc67fb7
commit 19387fd62e
2 changed files with 34 additions and 43 deletions

View File

@@ -33,7 +33,7 @@ distribution.
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
class OpenGLWidget : public QGLWidget
class OpenGLWidget : public QGLWidget, protected QOpenGLFunctions_3_1
{
public:
//Constructor
@@ -60,7 +60,6 @@ private:
GLuint vertexArrayObject;
QOpenGLShaderProgram shader;
QOpenGLFunctions_3_1* gl;
//Mouse data
QPoint m_LastFrameMousePos;