include more low-level bindings
[clinton/guile-figl.git] / upstream-man-pages / man4 / glBindBuffer.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id="glBindBuffer">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2005</year>
9 <holder>Sams Publishing</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glBindBuffer</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glBindBuffer</refname>
17 <refpurpose>bind a named buffer object</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glBindBuffer</function></funcdef>
23 <paramdef>GLenum <parameter>target</parameter></paramdef>
24 <paramdef>GLuint <parameter>buffer</parameter></paramdef>
25 </funcprototype>
26 </funcsynopsis>
27 </refsynopsisdiv>
28 <refsect1 id="parameters"><title>Parameters</title>
29 <variablelist>
30 <varlistentry>
31 <term><parameter>target</parameter></term>
32 <listitem>
33 <para>
34 Specifies the target to which the buffer object is bound.
35 The symbolic constant must be
36 <constant>GL_ARRAY_BUFFER</constant>,
37 <constant>GL_ATOMIC_COUNTER_BUFFER</constant>,
38 <constant>GL_COPY_READ_BUFFER</constant>,
39 <constant>GL_COPY_WRITE_BUFFER</constant>,
40 <constant>GL_DRAW_INDIRECT_BUFFER</constant>,
41 <constant>GL_DISPATCH_INDIRECT_BUFFER</constant>,
42 <constant>GL_ELEMENT_ARRAY_BUFFER</constant>,
43 <constant>GL_PIXEL_PACK_BUFFER</constant>,
44 <constant>GL_PIXEL_UNPACK_BUFFER</constant>,
45 <constant>GL_SHADER_STORAGE_BUFFER</constant>,
46 <constant>GL_TEXTURE_BUFFER</constant>,
47 <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant>, or
48 <constant>GL_UNIFORM_BUFFER</constant>.
49 </para>
50 </listitem>
51 </varlistentry>
52 <varlistentry>
53 <term><parameter>buffer</parameter></term>
54 <listitem>
55 <para>
56 Specifies the name of a buffer object.
57 </para>
58 </listitem>
59 </varlistentry>
60 </variablelist>
61 </refsect1>
62 <refsect1 id="description"><title>Description</title>
63 <para>
64 <function>glBindBuffer</function> binds a buffer object to the specified buffer binding point. Calling <function>glBindBuffer</function> with
65 <parameter>target</parameter> set to one of the accepted symbolic constants and <parameter>buffer</parameter> set to the name
66 of a buffer object binds that buffer object name to the target. If no buffer object with name <parameter>buffer</parameter>
67 exists, one is created with that name. When a buffer object is bound to a target, the previous binding for that
68 target is automatically broken.
69 </para>
70 <para>
71 Buffer object names are unsigned integers. The value zero is reserved, but
72 there is no default buffer object for each buffer object target. Instead, <parameter>buffer</parameter> set to zero
73 effectively unbinds any buffer object previously bound, and restores client memory usage for that buffer object target (if supported for that target).
74 Buffer object names and the corresponding buffer object contents are local to
75 the shared object space of the current
76 GL rendering context;
77 two rendering contexts share buffer object names only if they
78 explicitly enable sharing between contexts through the appropriate GL windows interfaces functions.
79 </para>
80 <para>
81 <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry> must be used to generate a set of unused buffer object names.
82 </para>
83 <para>
84 The state of a buffer object immediately after it is first bound is an unmapped zero-sized memory buffer with
85 <constant>GL_READ_WRITE</constant> access and <constant>GL_STATIC_DRAW</constant> usage.
86 </para>
87 <para>
88 While a non-zero buffer object name is bound, GL operations on the target to which it is
89 bound affect the bound buffer object, and queries of the target to which it is bound return state
90 from the bound buffer object. While buffer object name zero is bound, as in the initial state,
91 attempts to modify or query state on the target to which it is bound generates an
92 <constant>GL_INVALID_OPERATION</constant> error.
93 </para>
94 <para>
95 When a non-zero buffer object is bound to the <constant>GL_ARRAY_BUFFER</constant> target,
96 the vertex array pointer parameter is interpreted as an offset within the
97 buffer object measured in basic machine units.
98 </para>
99 <para>
100 When a non-zero buffer object is bound to the <constant>GL_DRAW_INDIRECT_BUFFER</constant> target,
101 parameters for draws issued through <citerefentry><refentrytitle>glDrawArraysIndirect</refentrytitle></citerefentry>
102 and <citerefentry><refentrytitle>glDrawElementsIndirect</refentrytitle></citerefentry> are sourced
103 from the specified offset in that buffer object's data store.
104 </para>
105 <para>
106 When a non-zero buffer object is bound to the <constant>GL_DISPATCH_INDIRECT_BUFFER</constant> target,
107 the parameters for compute dispatches issued through <citerefentry><refentrytitle>glDispatchComputeIndirect</refentrytitle></citerefentry>
108 are sourced from the specified offset in that buffer object's data store.
109 </para>
110 <para>
111 While a non-zero buffer object is bound to the <constant>GL_ELEMENT_ARRAY_BUFFER</constant> target,
112 the indices parameter of <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>,
113 <citerefentry><refentrytitle>glDrawElementsInstanced</refentrytitle></citerefentry>,
114 <citerefentry><refentrytitle>glDrawElementsBaseVertex</refentrytitle></citerefentry>,
115 <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>,
116 <citerefentry><refentrytitle>glDrawRangeElementsBaseVertex</refentrytitle></citerefentry>,
117 <citerefentry><refentrytitle>glMultiDrawElements</refentrytitle></citerefentry>, or
118 <citerefentry><refentrytitle>glMultiDrawElementsBaseVertex</refentrytitle></citerefentry> is interpreted as an
119 offset within the buffer object measured in basic machine units.
120 </para>
121 <para>
122 While a non-zero buffer object is bound to the <constant>GL_PIXEL_PACK_BUFFER</constant> target,
123 the following commands are affected: <citerefentry><refentrytitle>glGetCompressedTexImage</refentrytitle></citerefentry>,
124 <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>, and
125 <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>. The pointer parameter is
126 interpreted as an offset within the buffer object measured in basic machine units.
127 </para>
128 <para>
129 While a non-zero buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target,
130 the following commands are affected:
131 <citerefentry><refentrytitle>glCompressedTexImage1D</refentrytitle></citerefentry>,
132 <citerefentry><refentrytitle>glCompressedTexImage2D</refentrytitle></citerefentry>,
133 <citerefentry><refentrytitle>glCompressedTexImage3D</refentrytitle></citerefentry>,
134 <citerefentry><refentrytitle>glCompressedTexSubImage1D</refentrytitle></citerefentry>,
135 <citerefentry><refentrytitle>glCompressedTexSubImage2D</refentrytitle></citerefentry>,
136 <citerefentry><refentrytitle>glCompressedTexSubImage3D</refentrytitle></citerefentry>,
137 <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
138 <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
139 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
140 <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>,
141 <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>, and
142 <citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry>. The pointer parameter is
143 interpreted as an offset within the buffer object measured in basic machine units.
144 </para>
145 <para>
146 The buffer targets <constant>GL_COPY_READ_BUFFER</constant> and <constant>GL_COPY_WRITE_BUFFER</constant>
147 are provided to allow <citerefentry><refentrytitle>glCopyBufferSubData</refentrytitle></citerefentry>
148 to be used without disturbing the state of other bindings. However, <citerefentry><refentrytitle>glCopyBufferSubData</refentrytitle></citerefentry>
149 may be used with any pair of buffer binding points.
150 </para>
151 <para>
152 The <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant> buffer binding point may be passed to <function>glBindBuffer</function>,
153 but will not directly affect transform feedback state. Instead, the indexed <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant>
154 bindings must be used through a call to <citerefentry><refentrytitle>glBindBufferBase</refentrytitle></citerefentry>
155 or <citerefentry><refentrytitle>glBindBufferRange</refentrytitle></citerefentry>. This will affect the generic
156 <constant>GL_TRANSFORM_FEEDABCK_BUFFER</constant> binding.
157 </para>
158 <para>
159 Likewise, the <constant>GL_UNIFORM_BUFFER</constant>, <constant>GL_ATOMIC_COUNTER_BUFFER</constant> and <constant>GL_SHADER_STORAGE_BUFFER</constant>
160 buffer binding points may
161 be used, but do not directly affect uniform buffer, atomic counter buffer or shader storage buffer state, respectively.
162 <citerefentry><refentrytitle>glBindBufferBase</refentrytitle></citerefentry>
163 or <citerefentry><refentrytitle>glBindBufferRange</refentrytitle></citerefentry> must be used to bind a buffer to
164 an indexed uniform buffer, atomic counter buffer or shader storage buffer binding point.
165 </para>
166 <para>
167 A buffer object binding created with <function>glBindBuffer</function> remains active until a different
168 buffer object name is bound to the same target, or until the bound buffer object is
169 deleted with <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>.
170 </para>
171 <para>
172 Once created, a named buffer object may be re-bound to any target as often as needed. However,
173 the GL implementation may make choices about how to optimize the storage of a buffer object based
174 on its initial binding target.
175 </para>
176 </refsect1>
177 <refsect1 id="notes"><title>Notes</title>
178 <para>
179 The <constant>GL_COPY_READ_BUFFER</constant>, <constant>GL_UNIFORM_BUFFER</constant> and
180 <constant>GL_TEXTURE_BUFFER</constant> targets are available only if the GL version is 3.1 or greater.
181 </para>
182 <para>
183 The <constant>GL_ATOMIC_COUNTER_BUFER</constant> target is available only if the GL version is 4.2 or greater.
184 </para>
185 <para>
186 The <constant>GL_DISPATCH_INDIRECT_BUFFER</constant> and <constant>GL_SHADER_STORAGE_BUFFER</constant> targets are available only if the GL version is 4.3 or greater.
187 </para>
188 </refsect1>
189 <refsect1 id="errors"><title>Errors</title>
190 <para>
191 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable
192 values.
193 </para>
194 <para>
195 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>buffer</parameter> is not a name previously returned
196 from a call to <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry>.
197 </para>
198 </refsect1>
199 <refsect1 id="associatedgets"><title>Associated Gets</title>
200 <para>
201 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ARRAY_BUFFER_BINDING</constant>
202 </para>
203 <para>
204 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ATOMIC_COUNTER_BUFFER_BINDING</constant>
205 </para>
206 <para>
207 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COPY_READ_BUFFER_BINDING</constant>
208 </para>
209 <para>
210 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COPY_WRITE_BUFFER_BINDING</constant>
211 </para>
212 <para>
213 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_DRAW_INDIRECT_BUFFER_BINDING</constant>
214 </para>
215 <para>
216 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_DISPATCH_INDIRECT_BUFFER_BINDING</constant>
217 </para>
218 <para>
219 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ELEMENT_ARRAY_BUFFER_BINDING</constant>
220 </para>
221 <para>
222 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_PACK_BUFFER_BINDING</constant>
223 </para>
224 <para>
225 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
226 </para>
227 <para>
228 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_SHADER_STORAGE_BUFFER_BINDING</constant>
229 </para>
230 <para>
231 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TRANSFORM_FEEDBACK_BUFFER_BINDING</constant>
232 </para>
233 <para>
234 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_UNIFORM_BUFFER_BINDING</constant>
235 </para>
236 </refsect1>
237 <refsect1 id="seealso"><title>See Also</title>
238 <para>
239 <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry>,
240 <citerefentry><refentrytitle>glBindBufferBase</refentrytitle></citerefentry>,
241 <citerefentry><refentrytitle>glBindBufferRange</refentrytitle></citerefentry>,
242 <citerefentry><refentrytitle>glMapBuffer</refentrytitle></citerefentry>,
243 <citerefentry><refentrytitle>glUnmapBuffer</refentrytitle></citerefentry>,
244 <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>,
245 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,
246 <citerefentry><refentrytitle>glIsBuffer</refentrytitle></citerefentry>
247 </para>
248 </refsect1>
249 <refsect1 id="Copyright"><title>Copyright</title>
250 <para>
251 Copyright <trademark class="copyright"></trademark> 2005 Addison-Wesley.
252 Copyright <trademark class="copyright"></trademark> 2010-2011 Khronos Group.
253 This material may be distributed subject to the terms and conditions set forth in
254 the Open Publication License, v 1.0, 8 June 1999.
255 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
256 </para>
257 </refsect1>
258 </refentry>