What is the role of glBindVertexArrays vs glBindBuffer and what is their relationship?

前端 未结 5 2008
离开以前
离开以前 2020-12-12 10:02

I\'m new to OpenGL and Graphics Programming. I\'ve been reading a textbook which has been really thorough and well-written so far.However, I\'ve hit a point in the code that

5条回答
  •  感情败类
    2020-12-12 10:13

    The relationship is created when calling glVertexAttribPointer.

    Overview of VertexArrays

    GL_VERTEX_ARRAY_BINDING and GL_ARRAY_BUFFER_BINDING are constants but they can point to the global state of the binding. I'm referring to the state not the constant(orange) in the image. Use glGet to find about different global states.

    VertexArray is grouping information(including array buffer) about a vertex or many parallel vertices.

    Use GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING with glGetVertexAttrib to find which attribute array buffer is set.

    glBindBuffer(GL_ARRAY_BUFFER sets the global state GL_ARRAY_BUFFER_BINDING

    glBindVertexArray sets the global state GL_VERTEX_ARRAY_BINDING

提交回复
热议问题