Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: how to alternate 2 VBOs inside one VAO

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    24

    Question how to alternate 2 VBOs inside one VAO

    I'm trying to implement a particle system using compute shader. I have 2 vertex buffer objects set up, I need to draw them alternatively every frame. Is there a way that I can alternate them inside the vertex array object? Or do I have to explicitly bind vbo and call glVertexAttribPointer every draw? Thanks in advance.
    Code :
    // 2 vertex buffer objects
    GLuint m_posBO1;
    GLuint m_posBO2;
     
    glBindVertexArray(m_vao);
     
    glBindBuffer(GL_ARRAY_BUFFER, m_posBO1);
    // position attribute
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,687
    GL_ARB_vertex_attrib_binding is ideal for this kind of use case - it's just a single glBindVertexBuffer call.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    24
    that's it. thank you

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •