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. How To Use VBO in QT with opengl es?

How To Use VBO in QT with opengl es?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 4.4k Views 1 Watching
  • 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.
  • H Offline
    H Offline
    halftone
    wrote on last edited by
    #1

    when I was using qt with opengl es, in my render code, I used VBO in the way just like in win32 project, the code is the following:

    @
    void DrawMesh()

    {
    #if 1
    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    GLuint buf1,buf2;
    glGenBuffers(1,&buf1);
    glBindBuffer(GL_ARRAY_BUFFER,buf1);
    GLfloat a[]={
    0.0f, 0.0f, 0.0f, 0.0f,
    1.0f, 0.0f, 0.0f, 1.0f,
    0.0f, 1.0f, 0.0f, 2.0f
    };

    GLushort index[] = {
    0,1,2
    };
    glBufferData(GL_ARRAY_BUFFER,12sizeof(GLfloat),a,GL_STATIC_DRAW);
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3,GL_FLOAT,4
    sizeof(GL_FLOAT),0);
    glGenBuffers(1,&buf2);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,buf2);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER,3*sizeof(GLushort),index,GL_STATIC_DRAW);
    glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_SHORT,0);
    glDisableClientState(GL_VERTEX_ARRAY);
    #endif
    }
    @

    when run to “glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_SHORT,0);” error occured “Unhandled exception at 0×0239faec in hellogl_es2.exe: 0xC0000005: Access violation reading location 0×00000000. ”
    I want to know why this happened?
    here if I remove VBO parts, no error occured, how to use VBO in QT?

    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