void {@native glBufferData}(GLenum target, ptrdiff_t size, const GLvoid * data, GLenum usage);
glBufferData
lets you create and initialize the data store of a buffer object. If data
is non-null
, then the source data is copied to the buffer object�s data store. If data
is null
, then the contents of the buffer object�s data store are undefined.
The options for usage
are:
GL_STATIC_DRAW
Where the data store contents will be specified once by the application, and used many times as the source for GL drawing commands.
GL_DYNAMIC_DRAW
Where the data store contents will be respecified repeatedly by the application, and used many times as the source for GL drawing commands.
glBufferData
deletes any existing data store, and sets the values of the buffer object�s state variables thus:
GL_BUFFER_SIZE
initialized to size
.
GL_BUFFER_USAGE
initialized to usage
.
GL_BUFFER_ACCESS
initialized to GL_WRITE_ONLY
.
Clients must align data elements consistent with the requirements of the client platform, with an additional base-level requirement that an offset within a buffer to a datum comprising N basic machine units be a multiple of N.
usage
is provided as a performance hint only. The specified usage value does not constrain the actual usage pattern of the data store.
GL_INVALID_ENUM
is generated if target
is not one of the allowable values.
GL_INVALID_ENUM
is generated if usage
is not one of the allowable values.
GL_OUT_OF_MEMORY
is generated if the GL is unable to create a data store of the requested size.
@param target Specifies the buffer object target, which must beGL_ARRAY_BUFFER
or GL_ELEMENT_ARRAY_BUFFER
.
@param size Specifies the size of the data store in basic machineunits.
@param data Specifies the source data in client memory.
@param usage Specifies the expected application usage pattern ofthe data store. Accepted values are GL_STATIC_DRAW
and GL_DYNAMIC_DRAW
.
@exception IllegalArgumentException if data
isnon-null
but is not a direct buffer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|