update upstream sources
[clinton/guile-figl.git] / upstream-doc / man3 / 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_COPY_READ_BUFFER</constant>,
38 <constant>GL_COPY_WRITE_BUFFER</constant>,
39 <constant>GL_ELEMENT_ARRAY_BUFFER</constant>,
40 <constant>GL_PIXEL_PACK_BUFFER</constant>,
41 <constant>GL_PIXEL_UNPACK_BUFFER</constant>,
42 <constant>GL_TEXTURE_BUFFER</constant>,
43 <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant>, or
44 <constant>GL_UNIFORM_BUFFER</constant>.
45 </para>
46 </listitem>
47 </varlistentry>
48 <varlistentry>
49 <term><parameter>buffer</parameter></term>
50 <listitem>
51 <para>
52 Specifies the name of a buffer object.
53 </para>
54 </listitem>
55 </varlistentry>
56 </variablelist>
57 </refsect1>
58 <refsect1 id="description"><title>Description</title>
59 <para>
60 <function>glBindBuffer</function> binds a buffer object to the specified buffer binding point. Calling <function>glBindBuffer</function> with
61 <parameter>target</parameter> set to one of the accepted symbolic constants and <parameter>buffer</parameter> set to the name
62 of a buffer object binds that buffer object name to the target. If no buffer object with name <parameter>buffer</parameter>
63 exists, one is created with that name. When a buffer object is bound to a target, the previous binding for that
64 target is automatically broken.
65 </para>
66 <para>
67 Buffer object names are unsigned integers. The value zero is reserved, but
68 there is no default buffer object for each buffer object target. Instead, <parameter>buffer</parameter> set to zero
69 effectively unbinds any buffer object previously bound, and restores client memory usage for that buffer object target (if supported for that target).
70 Buffer object names and the corresponding buffer object contents are local to
71 the shared object space of the current
72 GL rendering context;
73 two rendering contexts share buffer object names only if they
74 explicitly enable sharing between contexts through the appropriate GL windows interfaces functions.
75 </para>
76 <para>
77 <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry> must be used to generate a set of unused buffer object names.
78 </para>
79 <para>
80 The state of a buffer object immediately after it is first bound is an unmapped zero-sized memory buffer with
81 <constant>GL_READ_WRITE</constant> access and <constant>GL_STATIC_DRAW</constant> usage.
82 </para>
83 <para>
84 While a non-zero buffer object name is bound, GL operations on the target to which it is
85 bound affect the bound buffer object, and queries of the target to which it is bound return state
86 from the bound buffer object. While buffer object name zero is bound, as in the initial state,
87 attempts to modify or query state on the target to which it is bound generates an
88 <constant>GL_INVALID_OPERATION</constant> error.
89 </para>
90 <para>
91 When a non-zero buffer object is bound to the <constant>GL_ARRAY_BUFFER</constant> target,
92 the vertex array pointer parameter is interpreted as an offset within the
93 buffer object measured in basic machine units.
94 </para>
95 <para>
96 While a non-zero buffer object is bound to the <constant>GL_ELEMENT_ARRAY_BUFFER</constant> target,
97 the indices parameter of <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>,
98 <citerefentry><refentrytitle>glDrawElementsInstanced</refentrytitle></citerefentry>,
99 <citerefentry><refentrytitle>glDrawElementsBaseVertex</refentrytitle></citerefentry>,
100 <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>,
101 <citerefentry><refentrytitle>glDrawRangeElementsBaseVertex</refentrytitle></citerefentry>,
102 <citerefentry><refentrytitle>glMultiDrawElements</refentrytitle></citerefentry>, or
103 <citerefentry><refentrytitle>glMultiDrawElementsBaseVertex</refentrytitle></citerefentry> is interpreted as an
104 offset within the buffer object measured in basic machine units.
105 </para>
106 <para>
107 While a non-zero buffer object is bound to the <constant>GL_PIXEL_PACK_BUFFER</constant> target,
108 the following commands are affected: <citerefentry><refentrytitle>glGetCompressedTexImage</refentrytitle></citerefentry>,
109 <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>, and
110 <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>. The pointer parameter is
111 interpreted as an offset within the buffer object measured in basic machine units.
112 </para>
113 <para>
114 While a non-zero buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target,
115 the following commands are affected:
116 <citerefentry><refentrytitle>glCompressedTexImage1D</refentrytitle></citerefentry>,
117 <citerefentry><refentrytitle>glCompressedTexImage2D</refentrytitle></citerefentry>,
118 <citerefentry><refentrytitle>glCompressedTexImage3D</refentrytitle></citerefentry>,
119 <citerefentry><refentrytitle>glCompressedTexSubImage1D</refentrytitle></citerefentry>,
120 <citerefentry><refentrytitle>glCompressedTexSubImage2D</refentrytitle></citerefentry>,
121 <citerefentry><refentrytitle>glCompressedTexSubImage3D</refentrytitle></citerefentry>,
122 <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
123 <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
124 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
125 <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>,
126 <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>, and
127 <citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry>. The pointer parameter is
128 interpreted as an offset within the buffer object measured in basic machine units.
129 </para>
130 <para>
131 The buffer targets <constant>GL_COPY_READ_BUFFER</constant> and <constant>GL_COPY_WRITE_BUFFER</constant>
132 are provided to allow <citerefentry><refentrytitle>glCopyBufferSubData</refentrytitle></citerefentry>
133 to be used without disturbing the state of other bindings. However, <citerefentry><refentrytitle>glCopyBufferSubData</refentrytitle></citerefentry>
134 may be used with any pair of buffer binding points.
135 </para>
136 <para>
137 The <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant> buffer binding point may be passed to <function>glBindBuffer</function>,
138 but will not directly affect transform feedback state. Instead, the indexed <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant>
139 bindings must be used through a call to <citerefentry><refentrytitle>glBindBufferBase</refentrytitle></citerefentry>
140 or <citerefentry><refentrytitle>glBindBufferRange</refentrytitle></citerefentry>. This will affect the generic
141 <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant> binding.
142 </para>
143 <para>
144 Likewise, the <constant>GL_UNIFORM_BUFFER</constant> buffer binding point may be used, but does not directly affect
145 uniform buffer state. <citerefentry><refentrytitle>glBindBufferBase</refentrytitle></citerefentry>
146 or <citerefentry><refentrytitle>glBindBufferRange</refentrytitle></citerefentry> must be used to bind a buffer to
147 an indexed uniform buffer binding point.
148 </para>
149 <para>
150 A buffer object binding created with <function>glBindBuffer</function> remains active until a different
151 buffer object name is bound to the same target, or until the bound buffer object is
152 deleted with <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>.
153 </para>
154 <para>
155 Once created, a named buffer object may be re-bound to any target as often as needed. However,
156 the GL implementation may make choices about how to optimize the storage of a buffer object based
157 on its initial binding target.
158 </para>
159 </refsect1>
160 <refsect1 id="notes"><title>Notes</title>
161 <para>
162 The <constant>GL_COPY_READ_BUFFER</constant>, <constant>GL_UNIFORM_BUFFER</constant> and
163 <constant>GL_TEXTURE_BUFFER</constant> targets are available only if the GL version is 3.1 or greater.
164 </para>
165 </refsect1>
166 <refsect1 id="errors"><title>Errors</title>
167 <para>
168 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable
169 values.
170 </para>
171 <para>
172 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>buffer</parameter> is not a name previously returned
173 from a call to <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry>.
174 </para>
175 </refsect1>
176 <refsect1 id="associatedgets"><title>Associated Gets</title>
177 <para>
178 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ARRAY_BUFFER_BINDING</constant>
179 </para>
180 <para>
181 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COPY_READ_BUFFER_BINDING</constant>
182 </para>
183 <para>
184 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COPY_WRITE_BUFFER_BINDING</constant>
185 </para>
186 <para>
187 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ELEMENT_ARRAY_BUFFER_BINDING</constant>
188 </para>
189 <para>
190 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_PACK_BUFFER_BINDING</constant>
191 </para>
192 <para>
193 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
194 </para>
195 <para>
196 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TRANSFORM_FEEDBACK_BUFFER_BINDING</constant>
197 </para>
198 <para>
199 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_UNIFORM_BUFFER_BINDING</constant>
200 </para>
201 </refsect1>
202 <refsect1 id="seealso"><title>See Also</title>
203 <para>
204 <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry>,
205 <citerefentry><refentrytitle>glBindBufferBase</refentrytitle></citerefentry>,
206 <citerefentry><refentrytitle>glBindBufferRange</refentrytitle></citerefentry>,
207 <citerefentry><refentrytitle>glMapBuffer</refentrytitle></citerefentry>,
208 <citerefentry><refentrytitle>glUnmapBuffer</refentrytitle></citerefentry>,
209 <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>,
210 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,
211 <citerefentry><refentrytitle>glIsBuffer</refentrytitle></citerefentry>
212 </para>
213 </refsect1>
214 <refsect1 id="Copyright"><title>Copyright</title>
215 <para>
216 Copyright <trademark class="copyright"></trademark> 2005 Addison-Wesley.
217 This material may be distributed subject to the terms and conditions set forth in
218 the Open Publication License, v 1.0, 8 June 1999.
219 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
220 </para>
221 </refsect1>
222 </refentry>