2607fd4a25712da30b6043ebbdca55670d0e5042
[clinton/guile-figl.git] / upstream-man-pages / man3 / glBufferData.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="glBufferData">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2005</year>
9 <holder>Sams Publishing</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glBufferData</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glBufferData</refname>
17 <refpurpose>creates and initializes a buffer object's data store</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glBufferData</function></funcdef>
23 <paramdef>GLenum <parameter>target</parameter></paramdef>
24 <paramdef>GLsizeiptr <parameter>size</parameter></paramdef>
25 <paramdef>const GLvoid * <parameter>data</parameter></paramdef>
26 <paramdef>GLenum <parameter>usage</parameter></paramdef>
27 </funcprototype>
28 </funcsynopsis>
29 </refsynopsisdiv>
30 <!-- eqn: ignoring delim $$ -->
31 <refsect1 id="parameters"><title>Parameters</title>
32 <variablelist>
33 <varlistentry>
34 <term><parameter>target</parameter></term>
35 <listitem>
36 <para>
37 Specifies the target buffer object.
38 The symbolic constant must be <constant>GL_ARRAY_BUFFER</constant>,
39 <constant>GL_COPY_READ_BUFFER</constant>,
40 <constant>GL_COPY_WRITE_BUFFER</constant>,
41 <constant>GL_ELEMENT_ARRAY_BUFFER</constant>,
42 <constant>GL_PIXEL_PACK_BUFFER</constant>,
43 <constant>GL_PIXEL_UNPACK_BUFFER</constant>,
44 <constant>GL_TEXTURE_BUFFER</constant>,
45 <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant>, or
46 <constant>GL_UNIFORM_BUFFER</constant>.
47 </para>
48 </listitem>
49 </varlistentry>
50 <varlistentry>
51 <term><parameter>size</parameter></term>
52 <listitem>
53 <para>
54 Specifies the size in bytes of the buffer object's new data store.
55 </para>
56 </listitem>
57 </varlistentry>
58 <varlistentry>
59 <term><parameter>data</parameter></term>
60 <listitem>
61 <para>
62 Specifies a pointer to data that will be copied into the data store for initialization,
63 or <constant>NULL</constant> if no data is to be copied.
64 </para>
65 </listitem>
66 </varlistentry>
67 <varlistentry>
68 <term><parameter>usage</parameter></term>
69 <listitem>
70 <para>
71 Specifies the expected usage pattern of the data store. The symbolic constant must be
72 <constant>GL_STREAM_DRAW</constant>, <constant>GL_STREAM_READ</constant>, <constant>GL_STREAM_COPY</constant>,
73 <constant>GL_STATIC_DRAW</constant>, <constant>GL_STATIC_READ</constant>, <constant>GL_STATIC_COPY</constant>,
74 <constant>GL_DYNAMIC_DRAW</constant>, <constant>GL_DYNAMIC_READ</constant>, or <constant>GL_DYNAMIC_COPY</constant>.
75 </para>
76 </listitem>
77 </varlistentry>
78 </variablelist>
79 </refsect1>
80 <refsect1 id="description"><title>Description</title>
81 <para>
82 <function>glBufferData</function> creates a new data store for the buffer object currently bound to
83 <parameter>target</parameter>. Any pre-existing data store is deleted. The new data store is created with the
84 specified <parameter>size</parameter> in bytes and <parameter>usage</parameter>. If <parameter>data</parameter>
85 is not <constant>NULL</constant>, the data store is initialized with data from this pointer. In its initial
86 state, the new data store is not mapped, it has a <constant>NULL</constant> mapped pointer, and its mapped access
87 is <constant>GL_READ_WRITE</constant>.
88 </para>
89 <para>
90 <parameter>usage</parameter> is a hint to the GL implementation as to how a buffer object's data store will be
91 accessed. This enables the GL implementation to make more intelligent decisions that may significantly
92 impact buffer object performance. It does not, however, constrain the actual usage of the data store.
93 <parameter>usage</parameter> can be broken down into two parts: first, the frequency of access (modification
94 and usage), and second, the nature of that access. The frequency of access may be one of these:
95 </para>
96 <variablelist>
97 <varlistentry>
98 <term>STREAM</term>
99 <listitem>
100 <para>
101 The data store contents will be modified once and used at most a few times.
102 </para>
103 </listitem>
104 </varlistentry>
105 <varlistentry>
106 <term>STATIC</term>
107 <listitem>
108 <para>
109 The data store contents will be modified once and used many times.
110 </para>
111 </listitem>
112 </varlistentry>
113 <varlistentry>
114 <term>DYNAMIC</term>
115 <listitem>
116 <para>
117 The data store contents will be modified repeatedly and used many times.
118 </para>
119 </listitem>
120 </varlistentry>
121 </variablelist>
122 <para>
123 The nature of access may be one of these:
124 </para>
125 <variablelist>
126 <varlistentry>
127 <term>DRAW</term>
128 <listitem>
129 <para>
130 The data store contents are modified by the application, and used as the source for GL drawing and
131 image specification commands.
132 </para>
133 </listitem>
134 </varlistentry>
135 <varlistentry>
136 <term>READ</term>
137 <listitem>
138 <para>
139 The data store contents are modified by reading data from the GL, and used to return that data
140 when queried by the application.
141 </para>
142 </listitem>
143 </varlistentry>
144 <varlistentry>
145 <term>COPY</term>
146 <listitem>
147 <para>
148 The data store contents are modified by reading data from the GL, and used as the source for GL
149 drawing and image specification commands.
150 </para>
151 </listitem>
152 </varlistentry>
153 </variablelist>
154 </refsect1>
155 <refsect1 id="notes"><title>Notes</title>
156 <para>
157 If <parameter>data</parameter> is <constant>NULL</constant>, a data store of the specified size is still created,
158 but its contents remain uninitialized and thus undefined.
159 </para>
160 <para>
161 Clients must align data elements consistent with the requirements of the client
162 platform, with an additional base-level requirement that an offset within a buffer to
163 a datum comprising <inlineequation><mml:math><mml:mi mathvariant="italic">N</mml:mi> bytes be a
164 multiple of <mml:mi mathvariant="italic">N</mml:mi></mml:math></inlineequation>.
165 </para>
166 </refsect1>
167 <refsect1 id="errors"><title>Errors</title>
168 <para>
169 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not
170 one of the accepted buffer targets.
171 </para>
172 <para>
173 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>usage</parameter> is not
174 <constant>GL_STREAM_DRAW</constant>, <constant>GL_STREAM_READ</constant>, <constant>GL_STREAM_COPY</constant>,
175 <constant>GL_STATIC_DRAW</constant>, <constant>GL_STATIC_READ</constant>, <constant>GL_STATIC_COPY</constant>,
176 <constant>GL_DYNAMIC_DRAW</constant>, <constant>GL_DYNAMIC_READ</constant>, or <constant>GL_DYNAMIC_COPY</constant>.
177 </para>
178 <para>
179 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>size</parameter> is negative.
180 </para>
181 <para>
182 <constant>GL_INVALID_OPERATION</constant> is generated if the reserved buffer object name 0 is bound to <parameter>target</parameter>.
183 </para>
184 <para>
185 <constant>GL_OUT_OF_MEMORY</constant> is generated if the GL is unable to create a data store with the specified <parameter>size</parameter>.
186 </para>
187 </refsect1>
188 <refsect1 id="associatedgets"><title>Associated Gets</title>
189 <para>
190 <citerefentry><refentrytitle>glGetBufferSubData</refentrytitle></citerefentry>
191 </para>
192 <para>
193 <citerefentry><refentrytitle>glGetBufferParameter</refentrytitle></citerefentry> with argument <constant>GL_BUFFER_SIZE</constant> or <constant>GL_BUFFER_USAGE</constant>
194 </para>
195 </refsect1>
196 <refsect1 id="seealso"><title>See Also</title>
197 <para>
198 <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>,
199 <citerefentry><refentrytitle>glBufferSubData</refentrytitle></citerefentry>,
200 <citerefentry><refentrytitle>glMapBuffer</refentrytitle></citerefentry>,
201 <citerefentry><refentrytitle>glUnmapBuffer</refentrytitle></citerefentry>
202 </para>
203 </refsect1>
204 <refsect1 id="Copyright"><title>Copyright</title>
205 <para>
206 Copyright <trademark class="copyright"></trademark> 2005 Addison-Wesley.
207 This material may be distributed subject to the terms and conditions set forth in
208 the Open Publication License, v 1.0, 8 June 1999.
209 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
210 </para>
211 </refsect1>
212 </refentry>