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>CreateTexture2DResource</title>
8  </head>
9  <body>
10<h1><a href="../../../../nn/Overview.html">nn</a>::<a href="../../../../nn/gd/Overview.html">gd</a>::<a href="../../../../nn/gd/CTR/Overview.html">CTR</a>::<a href="../../../../nn/gd/CTR/Resource/Overview.html">Resource</a>::CreateTexture2DResource Member Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14static <a href="../../../../nnResult/Overview.html">nnResult</a> CreateTexture2DResource(
15     const <a href="../../../../nn/gd/CTR/Texture2DResourceDescription/Overview.html">Texture2DResourceDescription</a> * description,
16     const void * initialData,
17     <span>gdBool</span> autoGenerateMipMapsFromData,
18     Texture2DResource ** texture2DResource,
19     <span>gdBool</span> copyInitialData = GD_TRUE
20);
21</pre>
22    </div>
23<h2>Arguments</h2>
24    <div class="section">
25      <table class="arguments">
26        <thead>
27          <tr>
28            <td width="15" />
29<th>Name</th>
30<td>Description</td>
31          </tr>
32        </thead>
33        <tr>
34<td>in</td>
35<th>description</th>
36<td>Specifies the descriptor for creating a 2D texture resource.</td>
37        </tr>
38        <tr>
39<td>in</td>
40<th>initialData</th>
41<td>Specifies the initialization data for the texture resource. Specify <CODE>NULL </CODE> if there is no initialization data. If there is mipmap data, all of the levels need to be specified, so set <B>autoGenerateMipMapsFromData</B> to <CODE>GD_FALSE</CODE>. If you are using automatically created mipmaps, specify only the top level of mipmap data. The initialization data must be created in <CODE>LAYOUT_BLOCK_8</CODE> mode. (<CODE><a href="../../../../nn/gd/CTR/Resource/Helper/ConvertTextureResourceToNativeFormat.html">Helper::ConvertTextureResourceToNativeFormat</a></CODE> or<CODE><a href="../../../../nn/gd/CTR/Resource/Helper/ConvertCompressedTextureResourceToNativeFormat.html">Helper::ConvertCompressedTextureResourceToNativeFormat</a></CODE>) <br /></td>
42        </tr>
43        <tr>
44<td>in</td>
45<th>autoGenerateMipMapsFromData</th>
46<td>If automatic mipmap generation is enabled, uses <CODE>MemoryGenerateMipMaps</CODE> to generate them automatically from <SPAN class="argument">initialData</SPAN>. <CODE>MemoryGenerateMipMaps</CODE> is able to generate mipmaps with a resolution of 32 (sometimes 64) or greater. For more information, see the <a href="../../../../nn/gd/CTR/Memory/GenerateMipMaps.html">Memory::GenerateMipMaps</a> documentation. This can be used when the hardware resolution is 8 or higher. Thus, if you want to use a mipmap with resolution lower than 32, you must generate the mipmap manually. Specify <CODE>GD_FALSE</CODE> to <CODE>autoGenerateMipMapsFromData</CODE>.</td>
47        </tr>
48        <tr>
49<td>out</td>
50<th>texture2DResource</th>
51<td>Specifies the address storing the created 2D texture resource.</td>
52        </tr>
53        <tr>
54<td>in</td>
55<th>copyInitialData</th>
56<td>This parameter is used when initialization data is specified. The default is <CODE>true</CODE>. When this parameter is <CODE>true</CODE>, a memory area is allocated in the function (either FCRAM or VRAM specified by the descriptor), and then the initialization data is copied to the allocated memory. When this parameter is <CODE>false</CODE>, the <CODE>texture2DResource</CODE> memory address becomes the one allocated by the user (<CODE>initialData</CODE> address). In this case, the user must allocate a sufficient memory area with the correct memory alignment. If resources use some mipmaps, sufficient memory area must be allocated to all the mipmaps. Also, the user is responsible for releasing the data memory area after releasing the resource.</td>
57        </tr> </table>
58    </div>
59<h2>Return Values</h2>
60<div class="section">Returns the result of the operation. <br />
61      <table class="arguments">
62        <thead>
63          <tr>
64<th>Value</th>
65<td>Description</td>
66          </tr>
67        </thead>
68        <tr>
69<th><CODE>Result::IsSuccess</CODE></th>
70<td>Process was successful.</td>
71        </tr>
72        <tr>
73<th>ResultNullParameter</th>
74<td><CODE>NULL </CODE>was specified for <B>description </B>or <B>texture2DResource</B>.</td>
75        </tr>
76        <tr>
77<th><CODE>ResultInvalidTextureResolution</CODE></th>
78<td><CODE>O</CODE> was specified for either <B>m_Width</B> or<B> m_Height</B> of <CODE><a href="../../../../nn/gd/CTR/Texture2DResourceDescription/Overview.html">Texture2DResourceDescription</a></CODE>. The result is also returned if the layout is <CODE>LAYOUT_BLOCK_32</CODE> and the size is not correctly aligned. Also, this result is returned if a mipmap cannot be created for the given size of <B>m_Width</B> or<B> m_Height</B> for <CODE><a href="../../../../nn/gd/CTR/Texture2DResourceDescription/Overview.html">Texture2DResourceDescription</a></CODE>. The specified size must be a power of 2.</td>
79        </tr>
80        <tr>
81<th><CODE>ResultInvalidTextureMipLevelIndex</CODE></th>
82<td>The mipmap level index is invalid. </td>
83        </tr>
84        <tr>
85<th><CODE>ResultInvalidMemoryLayout</CODE></th>
86<td>Memory layout is not correct. This result is also returned if initialization data has been specified but the memory layout is not <span>Memory::LAYOUT_BLOCK_8</span>.</td>
87        </tr>
88        <tr>
89<th><CODE>ResultInvalidMemoryLocation</CODE></th>
90<td>The memory type is not valid.</td>
91        </tr>
92        <tr>
93<th><CODE>ResultInvalidTextureFormat</CODE></th>
94<td>The pixel format is incorrect. This result is also returned if the initialization data is in ETC format and mipmaps cannot be automatically created.</td>
95        </tr>
96        <tr>
97<th><CODE>ResultOutOfMemory</CODE></th>
98<td>Cannot obtain memory for the resource</td>
99        </tr>
100        <tr>
101<th>ResultOutOfMemoryExt</th>
102<td>Cannot obtain memory for the data.</td>
103        </tr>
104      </table> </div>
105<h2>Description</h2>
106    <div class="section">
107<p>Creates a 2D texture resource.</p><!-- write here --></div>
108<h2>See Also</h2>
109    <div class="section">
110<p class="reference"><a href="../../../../nn/gd/CTR/Texture2DResourceDescription/Overview.html">Texture2DResourceDescription</a><br /><a href="../../../../nn/gd/CTR/Resource/Helper/ConvertTextureResourceToNativeFormat.html">Helper::ConvertTextureResourceToNativeFormat</a><br /><a href="../../../../nn/gd/CTR/Resource/Helper/ConvertCompressedTextureResourceToNativeFormat.html">Helper::ConvertCompressedTextureResourceToNativeFormat</a><br /> </p>
111    </div>
112<h2>Revision History</h2>
113    <div class="section">
114      <dl class="history">
115        <dt>2011/02/17</dt>
116<dd>Initial version.<br />
117        </dd>
118      </dl>
119    </div>
120  <hr><p>CONFIDENTIAL</p></body>
121</html>