// 選択をはずすには 0 を指定する
glBindBuffer( GL_ARRAY_BUFFER, 0 );
// 頂点配列を格納するためのバッファを作成するには GL_ARRAY_BUFFER
glBindBuffer( GL_ARRAY_BUFFER, id );
// Index を格納するには GL_ELEMENT_ARRAY_BUFFER を指定する
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, id );
glBufferData
SYNTAX
glBufferData(
GLenum tgt,
GLsizeiptr size, // バッファオブジェクト全体のサイズ
const GLvoid *data, // コピー元のデータ
GLenum usage
)
DESC
Client Memory から BufferObject へデータをコピーする。
転送先は glBindBuffer() で指定しておく
データは glBufferData() をコールした時点で転送される。
Specifies the expected usage pattern of the data store.
The symbolic constant must be
GL_STREAM_DRAW,
GL_STREAM_READ,
GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.
usage is a hint to the GL implementation as to how a buffer object's data store will be accessed.
This enables the GL implementation to make more intelligent decisions that may significantly impact buffer object performance.
It does not, however, constrain the actual usage of the data store.
usage can be broken down into two parts:
first, the frequency of access (modification and usage),
and second, the nature of that access.
The frequency of access may be one of these:
STREAM
The data store contents will be modified once and used at most a few times.
STATIC
The data store contents will be modified once and used many times.
DYNAMIC
The data store contents will be modified repeatedly and used many times.
DRAW
The data store contents are modified by the application, and used as the source for GL drawing and image specification commands.
READ
The data store contents are modified by reading data from the GL, and used to return that data when queried by the application.
COPY
The data store contents are modified by reading data from the GL, and used as the source for GL drawing and image specification commands.