Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. problem with OpenGL drawing in qt
QtWS25 Last Chance

problem with OpenGL drawing in qt

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 322 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alex111
    wrote on last edited by
    #1

    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);
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved