b0042ddc88e61c8ae7a6fc439c71f383725c446a
[clinton/guile-figl.git] / upstream-man-pages / man2 / 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_ELEMENT_ARRAY_BUFFER</constant>,
38 <constant>GL_PIXEL_PACK_BUFFER</constant>, or
39 <constant>GL_PIXEL_UNPACK_BUFFER</constant>.
40 </para>
41 </listitem>
42 </varlistentry>
43 <varlistentry>
44 <term><parameter>buffer</parameter></term>
45 <listitem>
46 <para>
47 Specifies the name of a buffer object.
48 </para>
49 </listitem>
50 </varlistentry>
51 </variablelist>
52 </refsect1>
53 <refsect1 id="description"><title>Description</title>
54 <para>
55 <function>glBindBuffer</function> lets you create or use a named buffer object. Calling <function>glBindBuffer</function> with
56 <parameter>target</parameter> set to
57 <constant>GL_ARRAY_BUFFER</constant>, <constant>GL_ELEMENT_ARRAY_BUFFER</constant>, <constant>GL_PIXEL_PACK_BUFFER</constant> or
58 <constant>GL_PIXEL_UNPACK_BUFFER</constant> and <parameter>buffer</parameter> set to the name
59 of the new buffer object binds the buffer object name to the target.
60 When a buffer object is bound to a target, the previous binding for that
61 target is automatically broken.
62 </para>
63 <para>
64 Buffer object names are unsigned integers. The value zero is reserved, but
65 there is no default buffer object for each buffer object target. Instead, <parameter>buffer</parameter> set to zero
66 effectively unbinds any buffer object previously bound, and restores client memory usage for that buffer object target.
67 Buffer object names and the corresponding buffer object contents are local to
68 the shared display-list space (see <citerefentry><refentrytitle>glXCreateContext</refentrytitle></citerefentry>) of the current
69 GL rendering context;
70 two rendering contexts share buffer object names only if they
71 also share display lists.
72 </para>
73 <para>
74 You may use <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry> to generate a set of new buffer object names.
75 </para>
76 <para>
77 The state of a buffer object immediately after it is first bound is an unmapped zero-sized memory buffer with
78 <constant>GL_READ_WRITE</constant> access and <constant>GL_STATIC_DRAW</constant> usage.
79 </para>
80 <para>
81 While a non-zero buffer object name is bound, GL operations on the target to which it is
82 bound affect the bound buffer object, and queries of the target to which it is bound return state
83 from the bound buffer object. While buffer object name zero is bound, as in the initial state,
84 attempts to modify or query state on the target to which it is bound generates an
85 <constant>GL_INVALID_OPERATION</constant> error.
86 </para>
87 <para>
88 When vertex array pointer state is changed, for example by a call to
89 <citerefentry><refentrytitle>glNormalPointer</refentrytitle></citerefentry>,
90 the current buffer object binding (<constant>GL_ARRAY_BUFFER_BINDING</constant>) is copied into the
91 corresponding client state for the vertex array type being changed, for example
92 <constant>GL_NORMAL_ARRAY_BUFFER_BINDING</constant>. While a non-zero buffer object is bound to the
93 <constant>GL_ARRAY_BUFFER</constant> target, the vertex array pointer parameter that is traditionally
94 interpreted as a pointer to client-side memory is instead interpreted as an offset within the
95 buffer object measured in basic machine units.
96 </para>
97 <para>
98 While a non-zero buffer object is bound to the <constant>GL_ELEMENT_ARRAY_BUFFER</constant> target,
99 the indices parameter of <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>,
100 <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>, or
101 <citerefentry><refentrytitle>glMultiDrawElements</refentrytitle></citerefentry> that is traditionally
102 interpreted as a pointer to client-side memory is instead interpreted as an offset within the
103 buffer object measured in basic machine units.
104 </para>
105 <para>
106 While a non-zero buffer object is bound to the <constant>GL_PIXEL_PACK_BUFFER</constant> target,
107 the following commands are affected: <citerefentry><refentrytitle>glGetCompressedTexImage</refentrytitle></citerefentry>,
108 <citerefentry><refentrytitle>glGetConvolutionFilter</refentrytitle></citerefentry>,
109 <citerefentry><refentrytitle>glGetHistogram</refentrytitle></citerefentry>,
110 <citerefentry><refentrytitle>glGetMinmax</refentrytitle></citerefentry>,
111 <citerefentry><refentrytitle>glGetPixelMap</refentrytitle></citerefentry>,
112 <citerefentry><refentrytitle>glGetPolygonStipple</refentrytitle></citerefentry>,
113 <citerefentry><refentrytitle>glGetSeparableFilter</refentrytitle></citerefentry>,
114 <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>, and
115 <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>. The pointer parameter that is
116 traditionally interpreted as a pointer to client-side memory where the pixels are to be packed is instead
117 interpreted as an offset within the buffer object measured in basic machine units.
118 </para>
119 <para>
120 While a non-zero buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target,
121 the following commands are affected: <citerefentry><refentrytitle>glBitmap</refentrytitle></citerefentry>,
122 <citerefentry><refentrytitle>glColorSubTable</refentrytitle></citerefentry>,
123 <citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>,
124 <citerefentry><refentrytitle>glCompressedTexImage1D</refentrytitle></citerefentry>,
125 <citerefentry><refentrytitle>glCompressedTexImage2D</refentrytitle></citerefentry>,
126 <citerefentry><refentrytitle>glCompressedTexImage3D</refentrytitle></citerefentry>,
127 <citerefentry><refentrytitle>glCompressedTexSubImage1D</refentrytitle></citerefentry>,
128 <citerefentry><refentrytitle>glCompressedTexSubImage2D</refentrytitle></citerefentry>,
129 <citerefentry><refentrytitle>glCompressedTexSubImage3D</refentrytitle></citerefentry>,
130 <citerefentry><refentrytitle>glConvolutionFilter1D</refentrytitle></citerefentry>,
131 <citerefentry><refentrytitle>glConvolutionFilter2D</refentrytitle></citerefentry>,
132 <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>,
133 <citerefentry><refentrytitle>glPixelMap</refentrytitle></citerefentry>,
134 <citerefentry><refentrytitle>glPolygonStipple</refentrytitle></citerefentry>,
135 <citerefentry><refentrytitle>glSeparableFilter2D</refentrytitle></citerefentry>,
136 <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
137 <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
138 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
139 <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>,
140 <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>, and
141 <citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry>. The pointer parameter that is
142 traditionally interpreted as a pointer to client-side memory from which the pixels are to be unpacked is
143 instead interpreted as an offset within the buffer object measured in basic machine units.
144 </para>
145 <para>
146 A buffer object binding created with <function>glBindBuffer</function> remains active until a different
147 buffer object name is bound to the same target, or until the bound buffer object is
148 deleted with <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>.
149 </para>
150 <para>
151 Once created, a named buffer object may be re-bound to any target as often as needed. However,
152 the GL implementation may make choices about how to optimize the storage of a buffer object based
153 on its initial binding target.
154 </para>
155 </refsect1>
156 <refsect1 id="notes"><title>Notes</title>
157 <para>
158 <function>glBindBuffer</function> is available only if the GL version is 1.5 or greater.
159 </para>
160 <para>
161 <constant>GL_PIXEL_PACK_BUFFER</constant> and <constant>GL_PIXEL_UNPACK_BUFFER</constant> are
162 available only if the GL version is 2.1 or greater.
163 </para>
164 </refsect1>
165 <refsect1 id="errors"><title>Errors</title>
166 <para>
167 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable
168 values.
169 </para>
170 <para>
171 <constant>GL_INVALID_OPERATION</constant> is generated if <function>glBindBuffer</function> is executed
172 between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding
173 execution of <citerefentry><refentrytitle>glEnd</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_ELEMENT_ARRAY_BUFFER_BINDING</constant>
182 </para>
183 <para>
184 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_PACK_BUFFER_BINDING</constant>
185 </para>
186 <para>
187 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
188 </para>
189 </refsect1>
190 <refsect1 id="seealso"><title>See Also</title>
191 <para>
192 <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>,
193 <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry>,
194 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,
195 <citerefentry><refentrytitle>glIsBuffer</refentrytitle></citerefentry>
196 </para>
197 </refsect1>
198 <refsect1 id="Copyright"><title>Copyright</title>
199 <para>
200 Copyright <trademark class="copyright"></trademark> 2005 Addison-Wesley.
201 This material may be distributed subject to the terms and conditions set forth in
202 the Open Publication License, v 1.0, 8 June 1999.
203 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
204 </para>
205 </refsect1>
206 </refentry>