rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man2 / xhtml / glBindBuffer.xml
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
2 <!-- saved from url=(0013)about:internet -->
3 <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glBindBuffer</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glBindBuffer"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glBindBuffer — bind a named buffer object</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glBindBuffer</b>(</code></td><td>GLenum  </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLuint  </td><td><var class="pdparam">buffer</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p>
4 Specifies the target to which the buffer object is bound.
5 The symbolic constant must be
6 <code class="constant">GL_ARRAY_BUFFER</code>,
7 <code class="constant">GL_ELEMENT_ARRAY_BUFFER</code>,
8 <code class="constant">GL_PIXEL_PACK_BUFFER</code>, or
9 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code>.
10 </p></dd><dt><span class="term"><em class="parameter"><code>buffer</code></em></span></dt><dd><p>
11 Specifies the name of a buffer object.
12 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
13 <code class="function">glBindBuffer</code> lets you create or use a named buffer object. Calling <code class="function">glBindBuffer</code> with
14 <em class="parameter"><code>target</code></em> set to
15 <code class="constant">GL_ARRAY_BUFFER</code>, <code class="constant">GL_ELEMENT_ARRAY_BUFFER</code>, <code class="constant">GL_PIXEL_PACK_BUFFER</code> or
16 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> and <em class="parameter"><code>buffer</code></em> set to the name
17 of the new buffer object binds the buffer object name to the target.
18 When a buffer object is bound to a target, the previous binding for that
19 target is automatically broken.
20 </p><p>
21 Buffer object names are unsigned integers. The value zero is reserved, but
22 there is no default buffer object for each buffer object target. Instead, <em class="parameter"><code>buffer</code></em> set to zero
23 effectively unbinds any buffer object previously bound, and restores client memory usage for that buffer object target.
24 Buffer object names and the corresponding buffer object contents are local to
25 the shared display-list space (see <a class="citerefentry" href="glXCreateContext.xml"><span class="citerefentry"><span class="refentrytitle">glXCreateContext</span></span></a>) of the current
26 GL rendering context;
27 two rendering contexts share buffer object names only if they
28 also share display lists.
29 </p><p>
30 You may use <a class="citerefentry" href="glGenBuffers.xml"><span class="citerefentry"><span class="refentrytitle">glGenBuffers</span></span></a> to generate a set of new buffer object names.
31 </p><p>
32 The state of a buffer object immediately after it is first bound is an unmapped zero-sized memory buffer with
33 <code class="constant">GL_READ_WRITE</code> access and <code class="constant">GL_STATIC_DRAW</code> usage.
34 </p><p>
35 While a non-zero buffer object name is bound, GL operations on the target to which it is
36 bound affect the bound buffer object, and queries of the target to which it is bound return state
37 from the bound buffer object. While buffer object name zero is bound, as in the initial state,
38 attempts to modify or query state on the target to which it is bound generates an
39 <code class="constant">GL_INVALID_OPERATION</code> error.
40 </p><p>
41 When vertex array pointer state is changed, for example by a call to
42 <a class="citerefentry" href="glNormalPointer.xml"><span class="citerefentry"><span class="refentrytitle">glNormalPointer</span></span></a>,
43 the current buffer object binding (<code class="constant">GL_ARRAY_BUFFER_BINDING</code>) is copied into the
44 corresponding client state for the vertex array type being changed, for example
45 <code class="constant">GL_NORMAL_ARRAY_BUFFER_BINDING</code>. While a non-zero buffer object is bound to the
46 <code class="constant">GL_ARRAY_BUFFER</code> target, the vertex array pointer parameter that is traditionally
47 interpreted as a pointer to client-side memory is instead interpreted as an offset within the
48 buffer object measured in basic machine units.
49 </p><p>
50 While a non-zero buffer object is bound to the <code class="constant">GL_ELEMENT_ARRAY_BUFFER</code> target,
51 the indices parameter of <a class="citerefentry" href="glDrawElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawElements</span></span></a>,
52 <a class="citerefentry" href="glDrawRangeElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawRangeElements</span></span></a>, or
53 <a class="citerefentry" href="glMultiDrawElements.xml"><span class="citerefentry"><span class="refentrytitle">glMultiDrawElements</span></span></a> that is traditionally
54 interpreted as a pointer to client-side memory is instead interpreted as an offset within the
55 buffer object measured in basic machine units.
56 </p><p>
57 While a non-zero buffer object is bound to the <code class="constant">GL_PIXEL_PACK_BUFFER</code> target,
58 the following commands are affected: <a class="citerefentry" href="glGetCompressedTexImage.xml"><span class="citerefentry"><span class="refentrytitle">glGetCompressedTexImage</span></span></a>,
59 <a class="citerefentry" href="glGetConvolutionFilter.xml"><span class="citerefentry"><span class="refentrytitle">glGetConvolutionFilter</span></span></a>,
60 <a class="citerefentry" href="glGetHistogram.xml"><span class="citerefentry"><span class="refentrytitle">glGetHistogram</span></span></a>,
61 <a class="citerefentry" href="glGetMinmax.xml"><span class="citerefentry"><span class="refentrytitle">glGetMinmax</span></span></a>,
62 <a class="citerefentry" href="glGetPixelMap.xml"><span class="citerefentry"><span class="refentrytitle">glGetPixelMap</span></span></a>,
63 <a class="citerefentry" href="glGetPolygonStipple.xml"><span class="citerefentry"><span class="refentrytitle">glGetPolygonStipple</span></span></a>,
64 <a class="citerefentry" href="glGetSeparableFilter.xml"><span class="citerefentry"><span class="refentrytitle">glGetSeparableFilter</span></span></a>,
65 <a class="citerefentry" href="glGetTexImage.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexImage</span></span></a>, and
66 <a class="citerefentry" href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>. The pointer parameter that is
67 traditionally interpreted as a pointer to client-side memory where the pixels are to be packed is instead
68 interpreted as an offset within the buffer object measured in basic machine units.
69 </p><p>
70 While a non-zero buffer object is bound to the <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target,
71 the following commands are affected: <a class="citerefentry" href="glBitmap.xml"><span class="citerefentry"><span class="refentrytitle">glBitmap</span></span></a>,
72 <a class="citerefentry" href="glColorSubTable.xml"><span class="citerefentry"><span class="refentrytitle">glColorSubTable</span></span></a>,
73 <a class="citerefentry" href="glColorTable.xml"><span class="citerefentry"><span class="refentrytitle">glColorTable</span></span></a>,
74 <a class="citerefentry" href="glCompressedTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCompressedTexImage1D</span></span></a>,
75 <a class="citerefentry" href="glCompressedTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCompressedTexImage2D</span></span></a>,
76 <a class="citerefentry" href="glCompressedTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glCompressedTexImage3D</span></span></a>,
77 <a class="citerefentry" href="glCompressedTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCompressedTexSubImage1D</span></span></a>,
78 <a class="citerefentry" href="glCompressedTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCompressedTexSubImage2D</span></span></a>,
79 <a class="citerefentry" href="glCompressedTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glCompressedTexSubImage3D</span></span></a>,
80 <a class="citerefentry" href="glConvolutionFilter1D.xml"><span class="citerefentry"><span class="refentrytitle">glConvolutionFilter1D</span></span></a>,
81 <a class="citerefentry" href="glConvolutionFilter2D.xml"><span class="citerefentry"><span class="refentrytitle">glConvolutionFilter2D</span></span></a>,
82 <a class="citerefentry" href="glDrawPixels.xml"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>,
83 <a class="citerefentry" href="glPixelMap.xml"><span class="citerefentry"><span class="refentrytitle">glPixelMap</span></span></a>,
84 <a class="citerefentry" href="glPolygonStipple.xml"><span class="citerefentry"><span class="refentrytitle">glPolygonStipple</span></span></a>,
85 <a class="citerefentry" href="glSeparableFilter2D.xml"><span class="citerefentry"><span class="refentrytitle">glSeparableFilter2D</span></span></a>,
86 <a class="citerefentry" href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>,
87 <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
88 <a class="citerefentry" href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>,
89 <a class="citerefentry" href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>,
90 <a class="citerefentry" href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>, and
91 <a class="citerefentry" href="glTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a>. The pointer parameter that is
92 traditionally interpreted as a pointer to client-side memory from which the pixels are to be unpacked is
93 instead interpreted as an offset within the buffer object measured in basic machine units.
94 </p><p>
95 A buffer object binding created with <code class="function">glBindBuffer</code> remains active until a different
96 buffer object name is bound to the same target, or until the bound buffer object is
97 deleted with <a class="citerefentry" href="glDeleteBuffers.xml"><span class="citerefentry"><span class="refentrytitle">glDeleteBuffers</span></span></a>.
98 </p><p>
99 Once created, a named buffer object may be re-bound to any target as often as needed. However,
100 the GL implementation may make choices about how to optimize the storage of a buffer object based
101 on its initial binding target.
102 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
103 <code class="function">glBindBuffer</code> is available only if the GL version is 1.5 or greater.
104 </p><p>
105 <code class="constant">GL_PIXEL_PACK_BUFFER</code> and <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> are
106 available only if the GL version is 2.1 or greater.
107 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
108 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>target</code></em> is not one of the allowable
109 values.
110 </p><p>
111 <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glBindBuffer</code> is executed
112 between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding
113 execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
114 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
115 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ARRAY_BUFFER_BINDING</code>
116 </p><p>
117 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ELEMENT_ARRAY_BUFFER_BINDING</code>
118 </p><p>
119 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PIXEL_PACK_BUFFER_BINDING</code>
120 </p><p>
121 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PIXEL_UNPACK_BUFFER_BINDING</code>
122 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
123 <a class="citerefentry" href="glDeleteBuffers.xml"><span class="citerefentry"><span class="refentrytitle">glDeleteBuffers</span></span></a>,
124 <a class="citerefentry" href="glGenBuffers.xml"><span class="citerefentry"><span class="refentrytitle">glGenBuffers</span></span></a>,
125 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>,
126 <a class="citerefentry" href="glIsBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glIsBuffer</span></span></a>
127 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
128 Copyright <span class="trademark"></span>© 2005 Addison-Wesley.
129 This material may be distributed subject to the terms and conditions set forth in
130 the Open Publication License, v 1.0, 8 June 1999.
131 <a class="ulink" href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
132 </p></div></div></body></html>