1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../css/manpage.css" type="text/css" />
7<title>glBufferData</title>
8  </head>
9  <body>
10<h1><CODE>glBufferData</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14GL_APICALL void GL_APIENTRY glBufferData(
15     GLenum target,
16     GLsizeiptr size,
17     const void * data,
18     GLenum usage
19);
20</pre>
21    </div>
22<h2>Arguments</h2>
23    <div class="section">
24      <table class="arguments">
25        <thead>
26          <tr>
27            <td width="15" />
28<th>Name</th>
29<td>Description</td>
30          </tr>
31        </thead>
32        <tr>
33<td>in</td>
34<th>target</th>
35<td>Target</td>
36        </tr>
37        <tr>
38<td>in</td>
39<th>size</th>
40<td>Vertex data size.</td>
41        </tr>
42        <tr>
43<td>in</td>
44<th><CODE>data</CODE></th>
45<td>Pointer to the vertex data.</td>
46        </tr>
47        <tr>
48<td>in</td>
49<th>usage</th>
50<td>Vertex buffer usage.</td>
51        </tr> </table>
52    </div>
53<h2>Return Values</h2>
54<div class="section">No values are returned. </div>
55<h2>Description</h2>
56    <div class="section">
57<p>Loads vertex data into the current vertex buffer object.</p><P>
58Set <SPAN class="argument">target</SPAN> equal to <CODE>GL_ARRAY_BUFFER</CODE> or <CODE>GL_ELEMENT_ARRAY_BUFFER</CODE>.
59            </P><P>
60To specify the region that is accessed by the GPU, set <SPAN class="argument">target</SPAN> to a bitwise OR of the aforementioned and the following values.<TABLE><TR><TH><CODE>NN_GX_MEM_FCRAM</CODE></TH><TD>The GPU accesses main memory.</TD></TR><TR><TH><CODE>NN_GX_MEM_VRAMA</CODE></TH><TD>The GPU accesses VRAMA.</TD></TR><TR><TH><CODE>NN_GX_MEM_VRAMB</CODE></TH><TD>The GPU accesses VRAMB. By also specifying the following bitwise OR, you can specify whether to copy data to main memory.</TD></TR><TR><TH><CODE>GL_COPY_FCRAM_DMP</CODE></TH><TD>Create data copy in main memory.</TD></TR><TR><TH><CODE>GL_NO_COPY_FCRAM_DMP</CODE></TH><TD>Do not create data copy in main memory.</TD></TR></TABLE><!-- source                      NN_GX_MEM_FCRAM ・・・ FCRAMにGPUがアクセスします。 NN_GX_MEM_VRAMA ・・・ VRAMAにGPUがアクセスします。 NN_GX_MEM_VRAMB ・・・ VRAMBにGPUがアクセスします。 さらに次の値を論理和で指定することで、FCRAMにデータのコピーを生成するか否かを指定することができます。 GL_COPY_FCRAM_DMP ・・・ FCRAMにデータのコピーを生成します。 GL_NO_COPY_FCRAM_DMP ・・・ FCRAMにデータのコピーを生成しません。                 --></P><P>
61These combinations cause data to be transferred as follows.<TABLE><TR><TH>(<CODE>NN_GX_MEM_FCRAM</CODE> | <CODE>GL_NO_COPY_FCRAM_DMP</CODE>)</TH><TD>The GPU directly accesses the region specified by <SPAN class="argument">data</SPAN>.</TD></TR><TR><TH>(<CODE>NN_GX_MEM_VRAMA</CODE> | <CODE>GL_NO_COPY_FCRAM_DMP</CODE>)</TH><TD>A region is allocated in VRAMA; <SPAN class="argument">data</SPAN> is transferred to VRAMA via DMA; and then the GPU accesses VRAMA.</TD></TR><TR><TH>(<CODE>NN_GX_MEM_VRAMB</CODE> | <CODE>GL_NO_COPY_FCRAM_DMP</CODE>)</TH><TD>A region is allocated in VRAMB; <SPAN class="argument">data</SPAN> is transferred to VRAMB via DMA; and then the GPU accesses VRAMB.</TD></TR><TR><TH>(<CODE>NN_GX_MEM_FCRAM</CODE> | <CODE>GL_COPY_FCRAM_DMP</CODE>)</TH><TD>A region is allocated in main memory; <SPAN class="argument">data</SPAN> is copied to main memory by the CPU; and then the GPU accesses main memory.</TD></TR><TR><TH>(<CODE>NN_GX_MEM_VRAMA</CODE> | <CODE>GL_COPY_FCRAM_DMP</CODE>)</TH><TD>A region is allocated in main memory and VRAMA; <SPAN class="argument">data</SPAN> is copied to main memory by the CPU; <SPAN class="argument">data</SPAN> is transferred via DMA from main memory to VRAMA, and then the GPU accesses VRAMA.</TD></TR><TR><TH>(<CODE>NN_GX_MEM_VRAMB</CODE> | <CODE>GL_COPY_FCRAM_DMP</CODE>)</TH><TD>A region is allocated in main memory and VRAMB; <SPAN class="argument">data</SPAN> is copied to main memory by the CPU; <SPAN class="argument">data</SPAN> is transferred via DMA from main memory to VRAMB, and then the GPU accesses VRAMB.</TD></TR></TABLE><!-- source                      (NN_GX_MEM_FCRAM | GL_NO_COPY_FCRAM_DMP) ・・・ dataに指定した領域を直接GPUがアクセスする。 (NN_GX_MEM_VRAMA | GL_NO_COPY_FCRAM_DMP) ・・・ VRAMAに領域を確保し、DMAでdataからVRAMAへ転送し、VRAMAをGPUがアクセスする。 (NN_GX_MEM_VRAMB | GL_NO_COPY_FCRAM_DMP) ・・・ VRAMBに領域を確保し、DMAでdataからVRAMBへ転送し、VRAMBをGPUがアクセスする。 (NN_GX_MEM_FCRAM | GL_COPY_FCRAM_DMP) ・・・ FCRAMに領域を確保し、CPUでdataからFCRAMへコピーし、FCRAMをGPUがアクセスする。 (NN_GX_MEM_VRAMA | GL_COPY_FCRAM_DMP) ・・・ VRAMAおよびFCRAMに領域を確保し、CPUでdataからFCRAMへコピーし、DMAでFCRAMからVRAMAへ転送し、VRAMAをGPUがアクセスする。 (NN_GX_MEM_VRAMB | GL_COPY_FCRAM_DMP) ・・・ VRAMBおよびFCRAMに領域を確保し、CPUでdataからFCRAMへコピーし、DMAでFCRAMからVRAMBへ転送し、VRAMBをGPUがアクセスする。                 --></P><P>
62If not specifying any GPU access region or copying to main memory, then (<CODE>NN_GX_MEM_FCRAM</CODE> | <CODE>GL_COPY_FCRAM_DMP</CODE>) are applied. Set <SPAN class="argument">size</SPAN> equal to the vertex data size. You can only set <SPAN class="argument">usage</SPAN> to <CODE>GL_STATIC_DRAW</CODE>. When <SPAN class="argument">data</SPAN> is set to <CODE>NULL</CODE>, this function simply allocates a region as large as the data size.
63            </P><P>
64The following errors occur in this function.
65<TABLE><TR><TH><CODE>GL_INVALID_OPERATION</CODE></TH><TD>This function was called without any command-list objects bound.</TD></TR><TR><TH><CODE>GL_INVALID_ENUM</CODE></TH><TD><SPAN class="argument">target</SPAN> was set to an invalid value.</TD></TR><TR><TH><CODE>GL_OUT_OF_MEMORY</CODE></TH><TD>Failed to allocate the management region or the region for the vertex buffer data.</TD></TR><TR><TH><CODE>GL_INVALID_OPERATION</CODE></TH><TD><SPAN class="argument">target</SPAN> was set to an invalid option for the GPU access region and main memory copying.</TD></TR><TR><TH><CODE>GL_INVALID_OPERATION</CODE></TH><TD>Object <CODE>0</CODE> is bound to the current target.</TD></TR><TR><TH><CODE>GL_INVALID_OPERATION</CODE></TH><TD>Either the values <CODE>NN_GX_MEM_FCRAM | GL_NO_COPY_FCRAM_DMP</CODE> or the values <CODE>NN_GX_MEM_VRAMA</CODE> (or <CODE>VRAMB</CODE>) <CODE>| GL_COPY_FCRAM_DMP</CODE> were specified, and <SPAN class="argument">data</SPAN> is <CODE>0</CODE>.</TD></TR></TABLE></P></div>
66<h2>Revision History</h2>
67    <div class="section">
68      <dl class="history">
69        <dt>2010/08/11</dt>
70<dd>Corrected an error.<br />
71        </dd>
72        <dt>2010/05/07</dt>
73<dd>Added an error code that occurs when the <SPAN class="argument">data</SPAN> argument is 0.<br />
74        </dd>
75        <dt>2010/03/11</dt>
76<dd>Revised terminology. Added a description of the default value for the <SPAN class="argument">target</SPAN> argument.<br />
77        </dd>
78        <dt>2010/01/07</dt>
79<dd>Initial version.<br />
80        </dd>
81      </dl>
82    </div>
83  <hr><p>CONFIDENTIAL</p></body>
84</html>