Qt World Summit: Register Today!

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);
           glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);

Log in to reply