Error: 'QGLBuffer::IndexBuffer' is not a type



  • While creating a structure to hold information regarding an object, I am getting an unexpected error, something like

    @C:\K_QT\Learning\Minimal_Qt_OpenGL\minimal_example-build-desktop..\Qtopengl_minimal_example\glwindow.h:28: error: 'QGLBuffer::IndexBuffer' is not a type@

    The structure (in the file) looks like:

    @
    #ifndef GLWINDOW_H
    #define GLWINDOW_H

    #include <QGLWidget>
    #include <QTimer>
    #include <QtOpenGL/qglshaderprogram.h>
    #include <QtOpenGL>

    class GLWindow : public QGLWidget
    {
    Q_OBJECT
    public:
    GLWindow(QWidget *parent = 0);
    ~GLWindow();

    void resizeGL(int width, int height);
    void initializeGL();
    void paintGL();
    
    /////////////////////////////////////////////////////////////////////////////////////////////
    struct Drawable {
        QGLBuffer  vertexBuffer;
        QGLBuffer  indexBuffer(QGLBuffer::IndexBuffer); ///////////////// PROBLEM HERE
        int     faceCount;
        GLfloat transform[16];
    };
    /////////////////////////////////////////////////////////////////////////////////////////////
    
    struct Drawables
    {
        Drawable Truck;
        Drawable Cub01;
        Drawable Cube;
    };
    Drawable m_drawables;
    
    QMatrix4x4 truck;
    QMatrix4x4 cub01;
    QMatrix4x4 cube;
    
    void CreateDrawable(GLfloat* vertices,GLfloat* tex,GLfloat* normals,GLushort* face,int facecount,QMatrix4x4 &matrix);
    

    protected:
    QGLShaderProgram m_sampleProgram;
    };

    #endif // GLWINDOW_H
    @

    Initializing the vertexBuffer with 'QGLBuffer::VertexBuffer' leads to the same error, with both qglbuffer objects.

    Am I doing something wrong? (I am kind of clueless.)

    p.s. I am writing QT += opengl in my .pro file, and the project (though small) was compiling and running correctly until I decided to use buffers.



  • Try adding:

    @
    #include <QGLBuffer>
    @

    at the top of your file.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.