What does the GL_ARRAY_BUFFER target mean in glBindBuffer?

后端 未结 2 1391
太阳男子
太阳男子 2021-02-01 17:53

I was confused about the VBO,

glGenBuffers(1, &positionBufferObject);
glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject);

Besides GL_ARRA

2条回答
  •  温柔的废话
    2021-02-01 18:39

    In General

    Most OpenGL objects must be bound to locations in the OpenGL context called "targets" for them to be used. A target is nothing more than a place in the context where objects are bound.

    Different object types (buffers, textures, etc) have different sets of targets. Generally speaking, each target has a specific meaning: to bind one object to one target means that you want to use that object in whatever manner that target uses objects bound to it.

    Binding an object to one target does not affect whether the object is bound to another target (unless it's a texture object; they treat targets differently).

    There are functions that modify objects or query data from bound objects. They take a target to which the object they are modifying/querying has been bound.

    GL_ARRAY_BUFFER

    The GL_ARRAY_BUFFER target for buffer objects represents the intent to use that buffer object for vertex attribute data. However, binding to this target alone doesn't do anything; it's only the call to glVertexAttribPointer (or equivalent functions) that uses whatever buffer was bound to that target for the attribute data for that attribute.

提交回复
热议问题