GLMAPBUFFR(3gl)GLMAPBUFFR(3gl)NAMEglMapBuffer - map the data store of a buffer object to the client's
address space
C SPECIFICATION
void * glMapBuffer( GLenum target,
GLenum access )
PARAMETERS
target Specifies the target buffer. Must be GL_ARRAY_BUFFER.
access Specifies the operations that the client may perform on the
data store. The following symbolic values are accepted:
GL_WRITE_ONLY, GL_READ_ONLY, GL_READ_WRITE.
DESCRIPTIONglMapBuffer maps the data store of a buffer object into the client's
address space. If the mapping is successful, it returns a pointer value
to the data store. Otherwise it returns NULL and GL_OUT_OF_MEMORY error
is generated.
Non-NULL pointers returned by glMapBuffer may be used by the client to
modify and query buffer object data, consistent with the access rules
of the mapping, while the mapping remains valid.
After the client has specified the contents of a mapped data store, and
before the data in that store are dereferenced by any GL commands, the
mappings must be relinquished by calling glUnmapBuffer.
glMapBuffer sets the buffer object states of GL_BUFFER_ACCESS to
access, GL_BUFFER_MAPPED to GL_TRUE, and GL_BUFFER_MAP_POINTER to a
pointer to the data store.
The access pattern can assume one of symbolic values:
GL_READ_ONLY
The client may perform read operation on the data store while
the data store is mapped.
GL_WRITE_ONLY
The client may perform write operation on the data store
while the data store is mapped.
GL_READ_WRITE
The client may perform read and write operations on the data
store while the data store is mapped.
NOTES
No GL error is generated if the pointer is used to attempt to modify a
READ_ONLY data store, or to attempt to read from WRITE_ONLY data store,
but operation may be slow and system errors may result. Pointer values
returned by glMapBuffer may not be passed as parameter values to GL
commands. For example, they may not be used to specify array pointers,
or to specify or query pixel or texture image data; such actions pro‐
duce undefined results.
ERRORS
GL_INVALID_ENUM is generated if target is not GL_ARRAY_BUFFER.
GL_INVALID_ENUM is generated if usage is not an accepted usage symbolic
constant.
GL_INVALID_OPERATION is generated if the data store is already in the
mapped state.
GL_OUT_OF_MEMORY is generated if it is unable to map the data store.
ASSOCIATED GETS
glGetBufferParameter with argument GL_BUFFER_SIZE
glGetBufferParameter with argument GL_BUFFER_USAGE
glGetBufferParameter with argument GL_BUFFER_ACCESS
glGetBufferParameter with argument GL_BUFFER_MAPPED
glGetBufferPointer with argument GL_BUFFER_MAP_POINTER
SEE ALSO
glBufferData, glBufferSubData.
13 Jan 04 GLMAPBUFFR(3gl)