problem with OpenGL drawing in qt



  • Hello, I try to draw two triangles, but only the first comes out, what's the problem?

      GLfloat vertices[] = {
                             0.0f, 0.0f,
                            +1.0f, +1.0f,
                           -1.0f, +1.0f,
    
                           0.0f, 0.0f,
                            -1.0f, -1.0f
                            +1.0f, -1.0f,
    };
            GLuint myBufferID;
           glGenBuffers(1, &myBufferID);
           glBindBuffer(GL_ARRAY_BUFFER, myBufferID);
           glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
           glEnableVertexAttribArray(0);
           glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
           glDrawArrays(GL_TRIANGLES,0,6);

Log in to reply
 

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