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