'\" t .\" Title: glBufferData .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 05/21/2015 .\" Manual: [FIXME: manual] .\" Source: [FIXME: source] .\" Language: English .\" .TH "GLBUFFERDATA" "3G" "05/21/2015" "[FIXME: source]" "[FIXME: manual]" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" glBufferData, glNamedBufferData \- creates and initializes a buffer object\*(Aqs data store .SH "C SPECIFICATION" .HP \w'void\ glBufferData('u .BI "void glBufferData(GLenum\ " "target" ", GLsizeiptr\ " "size" ", const\ GLvoid\ *\ " "data" ", GLenum\ " "usage" ");" .HP \w'void\ glNamedBufferData('u .BI "void glNamedBufferData(GLuint\ " "buffer" ", GLsizei\ " "size" ", const\ void\ *" "data" ", GLenum\ " "usage" ");" .SH "PARAMETERS" .PP \fItarget\fR .RS 4 Specifies the target to which the buffer object is bound for \fBglBufferData\fR, which must be one of the buffer binding targets in the following table: .TS allbox tab(:); lB lB. T{ \fBBuffer Binding Target\fR T}:T{ \fBPurpose\fR T} .T& l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ \fBGL_ARRAY_BUFFER\fR T}:T{ Vertex attributes T} T{ \fBGL_ATOMIC_COUNTER_BUFFER\fR T}:T{ Atomic counter storage T} T{ \fBGL_COPY_READ_BUFFER\fR T}:T{ Buffer copy source T} T{ \fBGL_COPY_WRITE_BUFFER\fR T}:T{ Buffer copy destination T} T{ \fBGL_DISPATCH_INDIRECT_BUFFER\fR T}:T{ Indirect compute dispatch commands T} T{ \fBGL_DRAW_INDIRECT_BUFFER\fR T}:T{ Indirect command arguments T} T{ \fBGL_ELEMENT_ARRAY_BUFFER\fR T}:T{ Vertex array indices T} T{ \fBGL_PIXEL_PACK_BUFFER\fR T}:T{ Pixel read target T} T{ \fBGL_PIXEL_UNPACK_BUFFER\fR T}:T{ Texture data source T} T{ \fBGL_QUERY_BUFFER\fR T}:T{ Query result buffer T} T{ \fBGL_SHADER_STORAGE_BUFFER\fR T}:T{ Read\-write storage for shaders T} T{ \fBGL_TEXTURE_BUFFER\fR T}:T{ Texture data buffer T} T{ \fBGL_TRANSFORM_FEEDBACK_BUFFER\fR T}:T{ Transform feedback buffer T} T{ \fBGL_UNIFORM_BUFFER\fR T}:T{ Uniform block storage T} .TE .sp .RE .PP \fIbuffer\fR .RS 4 Specifies the name of the buffer object for \fBglNamedBufferData\fR function\&. .RE .PP \fIsize\fR .RS 4 Specifies the size in bytes of the buffer object\*(Aqs new data store\&. .RE .PP \fIdata\fR .RS 4 Specifies a pointer to data that will be copied into the data store for initialization, or \fBNULL\fR if no data is to be copied\&. .RE .PP \fIusage\fR .RS 4 Specifies the expected usage pattern of the data store\&. The symbolic constant must be \fBGL_STREAM_DRAW\fR, \fBGL_STREAM_READ\fR, \fBGL_STREAM_COPY\fR, \fBGL_STATIC_DRAW\fR, \fBGL_STATIC_READ\fR, \fBGL_STATIC_COPY\fR, \fBGL_DYNAMIC_DRAW\fR, \fBGL_DYNAMIC_READ\fR, or \fBGL_DYNAMIC_COPY\fR\&. .RE .SH "DESCRIPTION" .PP \fBglBufferData\fR and \fBglNamedBufferData\fR create a new data store for a buffer object\&. In case of \fBglBufferData\fR, the buffer object currently bound to \fItarget\fR is used\&. For \fBglNamedBufferData\fR, a buffer object associated with ID specified by the caller in \fIbuffer\fR will be used instead\&. .PP While creating the new storage, any pre\-existing data store is deleted\&. The new data store is created with the specified \fIsize\fR in bytes and \fIusage\fR\&. If \fIdata\fR is not \fBNULL\fR, the data store is initialized with data from this pointer\&. In its initial state, the new data store is not mapped, it has a \fBNULL\fR mapped pointer, and its mapped access is \fBGL_READ_WRITE\fR\&. .PP \fIusage\fR is a hint to the GL implementation as to how a buffer object\*(Aqs 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\&. \fIusage\fR 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: .PP STREAM .RS 4 The data store contents will be modified once and used at most a few times\&. .RE .PP STATIC .RS 4 The data store contents will be modified once and used many times\&. .RE .PP DYNAMIC .RS 4 The data store contents will be modified repeatedly and used many times\&. .RE .PP The nature of access may be one of these: .PP DRAW .RS 4 The data store contents are modified by the application, and used as the source for GL drawing and image specification commands\&. .RE .PP READ .RS 4 The data store contents are modified by reading data from the GL, and used to return that data when queried by the application\&. .RE .PP COPY .RS 4 The data store contents are modified by reading data from the GL, and used as the source for GL drawing and image specification commands\&. .RE .SH "NOTES" .PP If \fIdata\fR is \fBNULL\fR, a data store of the specified size is still created, but its contents remain uninitialized and thus undefined\&. .PP Clients must align data elements consistently with the requirements of the client platform, with an additional base\-level requirement that an offset within a buffer to a datum comprising N bytes be a multiple of N\&. .PP The \fBGL_ATOMIC_COUNTER_BUFFER\fR target is available only if the GL version is 4\&.2 or greater\&. .PP The \fBGL_DISPATCH_INDIRECT_BUFFER\fR and \fBGL_SHADER_STORAGE_BUFFER\fR targets are available only if the GL version is 4\&.3 or greater\&. .PP The \fBGL_QUERY_BUFFER\fR target is available only if the GL version is 4\&.4 or greater\&. .SH "ERRORS" .PP \fBGL_INVALID_ENUM\fR is generated by \fBglBufferData\fR if \fItarget\fR is not one of the accepted buffer targets\&. .PP \fBGL_INVALID_ENUM\fR is generated if \fIusage\fR is not \fBGL_STREAM_DRAW\fR, \fBGL_STREAM_READ\fR, \fBGL_STREAM_COPY\fR, \fBGL_STATIC_DRAW\fR, \fBGL_STATIC_READ\fR, \fBGL_STATIC_COPY\fR, \fBGL_DYNAMIC_DRAW\fR, \fBGL_DYNAMIC_READ\fR, or \fBGL_DYNAMIC_COPY\fR\&. .PP \fBGL_INVALID_VALUE\fR is generated if \fIsize\fR is negative\&. .PP \fBGL_INVALID_OPERATION\fR is generated by \fBglBufferData\fR if the reserved buffer object name 0 is bound to \fItarget\fR\&. .PP \fBGL_INVALID_OPERATION\fR is generated by \fBglNamedBufferData\fR if buffer is not the name of an existing buffer object\&. .PP \fBGL_INVALID_OPERATION\fR is generated if the \fBGL_BUFFER_IMMUTABLE_STORAGE\fR flag of the buffer object is \fBGL_TRUE\fR\&. .PP \fBGL_OUT_OF_MEMORY\fR is generated if the GL is unable to create a data store with the specified \fIsize\fR\&. .SH "ASSOCIATED GETS" .PP \fBglGetBufferSubData\fR() .PP \fBglGetBufferParameter\fR() with argument \fBGL_BUFFER_SIZE\fR or \fBGL_BUFFER_USAGE\fR .SH "VERSION SUPPORT" .TS allbox tab(:); lB cB s s s s s s s s s s s lB cB cB cB cB cB cB cB cB cB cB cB cB. T{ T}:T{ \fBOpenGL Version\fR T} T{ \fBFunction / Feature Name\fR T}:T{ \fB2\&.0\fR T}:T{ \fB2\&.1\fR T}:T{ \fB3\&.0\fR T}:T{ \fB3\&.1\fR T}:T{ \fB3\&.2\fR T}:T{ \fB3\&.3\fR T}:T{ \fB4\&.0\fR T}:T{ \fB4\&.1\fR T}:T{ \fB4\&.2\fR T}:T{ \fB4\&.3\fR T}:T{ \fB4\&.4\fR T}:T{ \fB4\&.5\fR T} .T& l c c c c c c c c c c c c l c c c c c c c c c c c c. T{ \fBglBufferData\fR T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T} T{ \fBglNamedBufferData\fR T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ ✔ T} .TE .sp .SH "SEE ALSO" .PP \fBglBindBuffer\fR(), \fBglBufferSubData\fR(), \fBglMapBuffer\fR(), \fBglUnmapBuffer\fR() .SH "COPYRIGHT" .PP Copyright \(co 2005 Addison\-Wesley\&. Copyright \(co 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\&. \m[blue]\fBhttp://opencontent\&.org/openpub/\fR\m[]\&. .SH "COPYRIGHT" .br Copyright \(co 2005 Sams Publishing .br Copyright \(co 2010-2014 Khronos Group .br