glBindBuffer — 名前付きバッファーオブジェクトをバインドします
void glBindBuffer(
|
GLenum target, |
GLuint buffer); |
target
バッファーオブジェクトがバインドされるターゲットを指定します。これは、次の表のバッファーバインディングターゲットのいずれかである必要があります。
| Buffer Binding Target | Purpose |
|---|---|
GL_ARRAY_BUFFER
|
Vertex attributes |
GL_ATOMIC_COUNTER_BUFFER
|
Atomic counter storage |
GL_COPY_READ_BUFFER
|
Buffer copy source |
GL_COPY_WRITE_BUFFER
|
Buffer copy destination |
GL_DISPATCH_INDIRECT_BUFFER
|
Indirect compute dispatch commands |
GL_DRAW_INDIRECT_BUFFER
|
Indirect command arguments |
GL_ELEMENT_ARRAY_BUFFER
|
Vertex array indices |
GL_PIXEL_PACK_BUFFER
|
Pixel read target |
GL_PIXEL_UNPACK_BUFFER
|
Texture data source |
GL_QUERY_BUFFER
|
Query result buffer |
GL_SHADER_STORAGE_BUFFER
|
Read-write storage for shaders |
GL_TEXTURE_BUFFER
|
Texture data buffer |
GL_TRANSFORM_FEEDBACK_BUFFER
|
Transform feedback buffer |
GL_UNIFORM_BUFFER
|
Uniform block storage |
buffer
バッファーオブジェクトの名前を指定します。
バッファーオブジェクト名は符号なし整数です。
0 は予約済みですが、バッファーオブジェクトターゲットごとにデフォルトのバッファーオブジェクトはありません。
代わりに、0 に設定された buffer は、以前にバインドされたバッファーオブジェクトのバインドを事実上解除し、そのバッファーオブジェクトターゲットのクライアントメモリー使用量が回復します(そのターゲットでサポートされている場合)。
バッファーオブジェクト名と対応するバッファーオブジェクトのコンテキストは、カレントのGLレンダリングコンテキストの共有オブジェクトスペースに対してローカルです。
2つのレンダリングコンテキストは、適切なGLウィンドウインターフェイス関数を介してコンテキスト間の共有を明示的に有効にしている場合にのみ、バッファーオブジェクト名を共有します。
未使用のバッファオブジェクト名のセットは、glGenBuffers によって生成する必要があります。
The state of a buffer object immediately after it is first bound is an unmapped zero-sized memory buffer with
GL_READ_WRITE access and GL_STATIC_DRAW usage.
While a non-zero buffer object name is bound, GL operations on the target to which it is
bound affect the bound buffer object, and queries of the target to which it is bound return state
from the bound buffer object. While buffer object name zero is bound, as in the initial state,
attempts to modify or query state on the target to which it is bound generates an
GL_INVALID_OPERATION error.
When a non-zero buffer object is bound to the GL_ARRAY_BUFFER target,
the vertex array pointer parameter is interpreted as an offset within the
buffer object measured in basic machine units.
When a non-zero buffer object is bound to the GL_DRAW_INDIRECT_BUFFER target,
parameters for draws issued through glDrawArraysIndirect
and glDrawElementsIndirect are sourced
from the specified offset in that buffer object's data store.
When a non-zero buffer object is bound to the GL_DISPATCH_INDIRECT_BUFFER target,
the parameters for compute dispatches issued through glDispatchComputeIndirect
are sourced from the specified offset in that buffer object's data store.
While a non-zero buffer object is bound to the GL_ELEMENT_ARRAY_BUFFER target,
the indices parameter of glDrawElements,
glDrawElementsInstanced,
glDrawElementsBaseVertex,
glDrawRangeElements,
glDrawRangeElementsBaseVertex,
glMultiDrawElements, or
glMultiDrawElementsBaseVertex is interpreted as an
offset within the buffer object measured in basic machine units.
While a non-zero buffer object is bound to the GL_PIXEL_PACK_BUFFER target,
the following commands are affected: glGetCompressedTexImage,
glGetTexImage, and
glReadPixels. The pointer parameter is
interpreted as an offset within the buffer object measured in basic machine units.
While a non-zero buffer object is bound to the GL_PIXEL_UNPACK_BUFFER target,
the following commands are affected:
glCompressedTexImage1D,
glCompressedTexImage2D,
glCompressedTexImage3D,
glCompressedTexSubImage1D,
glCompressedTexSubImage2D,
glCompressedTexSubImage3D,
glTexImage1D,
glTexImage2D,
glTexImage3D,
glTexSubImage1D,
glTexSubImage2D, and
glTexSubImage3D. The pointer parameter is
interpreted as an offset within the buffer object measured in basic machine units.
The buffer targets GL_COPY_READ_BUFFER and GL_COPY_WRITE_BUFFER
are provided to allow glCopyBufferSubData
to be used without disturbing the state of other bindings. However, glCopyBufferSubData
may be used with any pair of buffer binding points.
The GL_TRANSFORM_FEEDBACK_BUFFER buffer binding point may be passed to glBindBuffer,
but will not directly affect transform feedback state. Instead, the indexed GL_TRANSFORM_FEEDBACK_BUFFER
bindings must be used through a call to glBindBufferBase
or glBindBufferRange. This will affect the generic
GL_TRANSFORM_FEEDBACK_BUFFER binding.
Likewise, the GL_UNIFORM_BUFFER, GL_ATOMIC_COUNTER_BUFFER and GL_SHADER_STORAGE_BUFFER
buffer binding points may
be used, but do not directly affect uniform buffer, atomic counter buffer or shader storage buffer state, respectively.
glBindBufferBase
or glBindBufferRange must be used to bind a buffer to
an indexed uniform buffer, atomic counter buffer or shader storage buffer binding point.
The GL_QUERY_BUFFER binding point is used to specify a buffer object that is to
receive the results of query objects through calls to the glGetQueryObject
family of commands.
A buffer object binding created with glBindBuffer remains active until a different
buffer object name is bound to the same target, or until the bound buffer object is
deleted with glDeleteBuffers.
Once created, a named buffer object may be re-bound to any target as often as needed. However, the GL implementation may make choices about how to optimize the storage of a buffer object based on its initial binding target.
The GL_COPY_READ_BUFFER, GL_UNIFORM_BUFFER and
GL_TEXTURE_BUFFER targets are available only if the GL version is 3.1 or greater.
The GL_ATOMIC_COUNTER_BUFFER target is available only if the GL version is 4.2 or greater.
The GL_DISPATCH_INDIRECT_BUFFER and GL_SHADER_STORAGE_BUFFER targets are available only if the GL version is 4.3 or greater.
The GL_QUERY_BUFFER target is available only if the GL version is 4.4 or greater.
GL_INVALID_ENUM is generated if target is not one of the allowable
values.
GL_INVALID_VALUE is generated if buffer is not a name previously returned
from a call to glGenBuffers.
glGet with argument GL_ARRAY_BUFFER_BINDING
glGet with argument GL_ATOMIC_COUNTER_BUFFER_BINDING
glGet with argument GL_COPY_READ_BUFFER_BINDING
glGet with argument GL_COPY_WRITE_BUFFER_BINDING
glGet with argument GL_DRAW_INDIRECT_BUFFER_BINDING
glGet with argument GL_DISPATCH_INDIRECT_BUFFER_BINDING
glGet with argument GL_ELEMENT_ARRAY_BUFFER_BINDING
glGet with argument GL_PIXEL_PACK_BUFFER_BINDING
glGet with argument GL_PIXEL_UNPACK_BUFFER_BINDING
glGet with argument GL_SHADER_STORAGE_BUFFER_BINDING
glGet with argument GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
glGet with argument GL_UNIFORM_BUFFER_BINDING
| OpenGL Version | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5 |
glBindBuffer
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glGenBuffers, glBindBufferBase, glBindBufferRange, glMapBuffer, glUnmapBuffer, glDeleteBuffers, glGet, glIsBuffer
Copyright © 2005 Addison-Wesley. Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.