Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?>\r |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"\r | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">\r | |
4 | <refentry id="glBindBuffer">\r | |
5 | <refmeta>\r | |
6 | <refmetainfo>\r | |
7 | <copyright>\r | |
8 | <year>2005</year>\r | |
9 | <holder>Sams Publishing</holder>\r | |
10 | </copyright>\r | |
11 | </refmetainfo>\r | |
12 | <refentrytitle>glBindBuffer</refentrytitle>\r | |
13 | <manvolnum>3G</manvolnum>\r | |
14 | </refmeta>\r | |
15 | <refnamediv>\r | |
16 | <refname>glBindBuffer</refname>\r | |
17 | <refpurpose>bind a named buffer object</refpurpose>\r | |
18 | </refnamediv>\r | |
19 | <refsynopsisdiv><title>C Specification</title>\r | |
20 | <funcsynopsis>\r | |
21 | <funcprototype>\r | |
22 | <funcdef>void <function>glBindBuffer</function></funcdef>\r | |
23 | <paramdef>GLenum <parameter>target</parameter></paramdef>\r | |
24 | <paramdef>GLuint <parameter>buffer</parameter></paramdef>\r | |
25 | </funcprototype>\r | |
26 | </funcsynopsis>\r | |
27 | </refsynopsisdiv>\r | |
28 | <refsect1 id="parameters"><title>Parameters</title>\r | |
29 | <variablelist>\r | |
30 | <varlistentry>\r | |
31 | <term><parameter>target</parameter></term>\r | |
32 | <listitem>\r | |
33 | <para>\r | |
34 | Specifies the target to which the buffer object is bound.\r | |
35 | The symbolic constant must be\r | |
36 | <constant>GL_ARRAY_BUFFER</constant>,\r | |
37 | <constant>GL_ELEMENT_ARRAY_BUFFER</constant>,\r | |
38 | <constant>GL_PIXEL_PACK_BUFFER</constant>, or\r | |
39 | <constant>GL_PIXEL_UNPACK_BUFFER</constant>.\r | |
40 | </para>\r | |
41 | </listitem>\r | |
42 | </varlistentry>\r | |
43 | <varlistentry>\r | |
44 | <term><parameter>buffer</parameter></term>\r | |
45 | <listitem>\r | |
46 | <para>\r | |
47 | Specifies the name of a buffer object.\r | |
48 | </para>\r | |
49 | </listitem>\r | |
50 | </varlistentry>\r | |
51 | </variablelist>\r | |
52 | </refsect1>\r | |
53 | <refsect1 id="description"><title>Description</title>\r | |
54 | <para>\r | |
55 | <function>glBindBuffer</function> lets you create or use a named buffer object. Calling <function>glBindBuffer</function> with\r | |
56 | <parameter>target</parameter> set to\r | |
57 | <constant>GL_ARRAY_BUFFER</constant>, <constant>GL_ELEMENT_ARRAY_BUFFER</constant>, <constant>GL_PIXEL_PACK_BUFFER</constant> or\r | |
58 | <constant>GL_PIXEL_UNPACK_BUFFER</constant> and <parameter>buffer</parameter> set to the name\r | |
59 | of the new buffer object binds the buffer object name to the target.\r | |
60 | When a buffer object is bound to a target, the previous binding for that\r | |
61 | target is automatically broken.\r | |
62 | </para>\r | |
63 | <para>\r | |
64 | Buffer object names are unsigned integers. The value zero is reserved, but\r | |
65 | there is no default buffer object for each buffer object target. Instead, <parameter>buffer</parameter> set to zero\r | |
66 | effectively unbinds any buffer object previously bound, and restores client memory usage for that buffer object target.\r | |
67 | Buffer object names and the corresponding buffer object contents are local to\r | |
68 | the shared display-list space (see <citerefentry><refentrytitle>glXCreateContext</refentrytitle></citerefentry>) of the current\r | |
69 | GL rendering context;\r | |
70 | two rendering contexts share buffer object names only if they\r | |
71 | also share display lists.\r | |
72 | </para>\r | |
73 | <para>\r | |
74 | You may use <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry> to generate a set of new buffer object names.\r | |
75 | </para>\r | |
76 | <para>\r | |
77 | The state of a buffer object immediately after it is first bound is an unmapped zero-sized memory buffer with\r | |
78 | <constant>GL_READ_WRITE</constant> access and <constant>GL_STATIC_DRAW</constant> usage.\r | |
79 | </para>\r | |
80 | <para>\r | |
81 | While a non-zero buffer object name is bound, GL operations on the target to which it is\r | |
82 | bound affect the bound buffer object, and queries of the target to which it is bound return state \r | |
83 | from the bound buffer object. While buffer object name zero is bound, as in the initial state,\r | |
84 | attempts to modify or query state on the target to which it is bound generates an \r | |
85 | <constant>GL_INVALID_OPERATION</constant> error.\r | |
86 | </para>\r | |
87 | <para>\r | |
88 | When vertex array pointer state is changed, for example by a call to \r | |
89 | <citerefentry><refentrytitle>glNormalPointer</refentrytitle></citerefentry>, \r | |
90 | the current buffer object binding (<constant>GL_ARRAY_BUFFER_BINDING</constant>) is copied into the \r | |
91 | corresponding client state for the vertex array type being changed, for example \r | |
92 | <constant>GL_NORMAL_ARRAY_BUFFER_BINDING</constant>. While a non-zero buffer object is bound to the \r | |
93 | <constant>GL_ARRAY_BUFFER</constant> target, the vertex array pointer parameter that is traditionally\r | |
94 | interpreted as a pointer to client-side memory is instead interpreted as an offset within the\r | |
95 | buffer object measured in basic machine units.\r | |
96 | </para>\r | |
97 | <para>\r | |
98 | While a non-zero buffer object is bound to the <constant>GL_ELEMENT_ARRAY_BUFFER</constant> target, \r | |
99 | the indices parameter of <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>, \r | |
100 | <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>, or \r | |
101 | <citerefentry><refentrytitle>glMultiDrawElements</refentrytitle></citerefentry> that is traditionally\r | |
102 | interpreted as a pointer to client-side memory is instead interpreted as an offset within the\r | |
103 | buffer object measured in basic machine units.\r | |
104 | </para>\r | |
105 | <para>\r | |
106 | While a non-zero buffer object is bound to the <constant>GL_PIXEL_PACK_BUFFER</constant> target, \r | |
107 | the following commands are affected: <citerefentry><refentrytitle>glGetCompressedTexImage</refentrytitle></citerefentry>, \r | |
108 | <citerefentry><refentrytitle>glGetConvolutionFilter</refentrytitle></citerefentry>,\r | |
109 | <citerefentry><refentrytitle>glGetHistogram</refentrytitle></citerefentry>,\r | |
110 | <citerefentry><refentrytitle>glGetMinmax</refentrytitle></citerefentry>,\r | |
111 | <citerefentry><refentrytitle>glGetPixelMap</refentrytitle></citerefentry>,\r | |
112 | <citerefentry><refentrytitle>glGetPolygonStipple</refentrytitle></citerefentry>,\r | |
113 | <citerefentry><refentrytitle>glGetSeparableFilter</refentrytitle></citerefentry>,\r | |
114 | <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>, and \r | |
115 | <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>. The pointer parameter that is \r | |
116 | traditionally interpreted as a pointer to client-side memory where the pixels are to be packed is instead \r | |
117 | interpreted as an offset within the buffer object measured in basic machine units.\r | |
118 | </para>\r | |
119 | <para>\r | |
120 | While a non-zero buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target, \r | |
121 | the following commands are affected: <citerefentry><refentrytitle>glBitmap</refentrytitle></citerefentry>, \r | |
122 | <citerefentry><refentrytitle>glColorSubTable</refentrytitle></citerefentry>,\r | |
123 | <citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>,\r | |
124 | <citerefentry><refentrytitle>glCompressedTexImage1D</refentrytitle></citerefentry>,\r | |
125 | <citerefentry><refentrytitle>glCompressedTexImage2D</refentrytitle></citerefentry>,\r | |
126 | <citerefentry><refentrytitle>glCompressedTexImage3D</refentrytitle></citerefentry>,\r | |
127 | <citerefentry><refentrytitle>glCompressedTexSubImage1D</refentrytitle></citerefentry>,\r | |
128 | <citerefentry><refentrytitle>glCompressedTexSubImage2D</refentrytitle></citerefentry>,\r | |
129 | <citerefentry><refentrytitle>glCompressedTexSubImage3D</refentrytitle></citerefentry>,\r | |
130 | <citerefentry><refentrytitle>glConvolutionFilter1D</refentrytitle></citerefentry>,\r | |
131 | <citerefentry><refentrytitle>glConvolutionFilter2D</refentrytitle></citerefentry>,\r | |
132 | <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>,\r | |
133 | <citerefentry><refentrytitle>glPixelMap</refentrytitle></citerefentry>,\r | |
134 | <citerefentry><refentrytitle>glPolygonStipple</refentrytitle></citerefentry>,\r | |
135 | <citerefentry><refentrytitle>glSeparableFilter2D</refentrytitle></citerefentry>,\r | |
136 | <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,\r | |
137 | <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,\r | |
138 | <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,\r | |
139 | <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>,\r | |
140 | <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>, and \r | |
141 | <citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry>. The pointer parameter that is \r | |
142 | traditionally interpreted as a pointer to client-side memory from which the pixels are to be unpacked is \r | |
143 | instead interpreted as an offset within the buffer object measured in basic machine units.\r | |
144 | </para>\r | |
145 | <para>\r | |
146 | A buffer object binding created with <function>glBindBuffer</function> remains active until a different\r | |
147 | buffer object name is bound to the same target, or until the bound buffer object is\r | |
148 | deleted with <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>.\r | |
149 | </para>\r | |
150 | <para>\r | |
151 | Once created, a named buffer object may be re-bound to any target as often as needed. However,\r | |
152 | the GL implementation may make choices about how to optimize the storage of a buffer object based\r | |
153 | on its initial binding target.\r | |
154 | </para>\r | |
155 | </refsect1>\r | |
156 | <refsect1 id="notes"><title>Notes</title>\r | |
157 | <para>\r | |
158 | <function>glBindBuffer</function> is available only if the GL version is 1.5 or greater.\r | |
159 | </para>\r | |
160 | <para>\r | |
161 | <constant>GL_PIXEL_PACK_BUFFER</constant> and <constant>GL_PIXEL_UNPACK_BUFFER</constant> are \r | |
162 | available only if the GL version is 2.1 or greater.\r | |
163 | </para>\r | |
164 | </refsect1>\r | |
165 | <refsect1 id="errors"><title>Errors</title>\r | |
166 | <para>\r | |
167 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable\r | |
168 | values.\r | |
169 | </para>\r | |
170 | <para>\r | |
171 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glBindBuffer</function> is executed\r | |
172 | between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding\r | |
173 | execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.\r | |
174 | </para>\r | |
175 | </refsect1>\r | |
176 | <refsect1 id="associatedgets"><title>Associated Gets</title>\r | |
177 | <para>\r | |
178 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ARRAY_BUFFER_BINDING</constant>\r | |
179 | </para>\r | |
180 | <para>\r | |
181 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ELEMENT_ARRAY_BUFFER_BINDING</constant>\r | |
182 | </para>\r | |
183 | <para>\r | |
184 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_PACK_BUFFER_BINDING</constant>\r | |
185 | </para>\r | |
186 | <para>\r | |
187 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>\r | |
188 | </para>\r | |
189 | </refsect1>\r | |
190 | <refsect1 id="seealso"><title>See Also</title>\r | |
191 | <para>\r | |
192 | <citerefentry><refentrytitle>glDeleteBuffers</refentrytitle></citerefentry>,\r | |
193 | <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry>,\r | |
194 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,\r | |
195 | <citerefentry><refentrytitle>glIsBuffer</refentrytitle></citerefentry>\r | |
196 | </para>\r | |
197 | </refsect1>\r | |
198 | <refsect1 id="Copyright"><title>Copyright</title>\r | |
199 | <para>\r | |
200 | Copyright <trademark class="copyright"></trademark> 2005 Addison-Wesley. \r | |
201 | This material may be distributed subject to the terms and conditions set forth in \r | |
202 | the Open Publication License, v 1.0, 8 June 1999.\r | |
203 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.\r | |
204 | </para>\r | |
205 | </refsect1>\r | |
206 | </refentry>\r |