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>Parameters</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 <SPAN class="argument">autoGenerateMipMapsFromData</SPAN> 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 the <CODE>MemoryGene rateMipMaps</CODE> function 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"><CODE>Memory::GenerateMipMaps</CODE></a> function reference. This can be used when the hardware resolution is 8 or higher. If you want to use a mipmap with resolution lower than 32, you must generate the mipmap manually. Specify GD_FALSE for <SPAN class="argument">autoGenerateMipMapsFromData</SPAN>.</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 <SPAN class="argument">texture2DResource</SPAN> memory address becomes the one allocated by the user (the address of <SPAN class="argument">initialData</SPAN>). 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><CODE>ResultNullParameter</CODE></th> 74<td><CODE>NULL</CODE> was specified for <SPAN class="argument">description</SPAN> or <SPAN class="argument">texture2DResource</SPAN>.</td> 75 </tr> 76 <tr> 77<th><CODE>ResultInvalidTextureResolution</CODE></th> 78<td><CODE>0</CODE> was specified for either <CODE>m_Width</CODE> or <CODE>m_Height</CODE> in <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 <CODE>m_Width</CODE> or <CODE>m_Height</CODE> in <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>ResultInvalidTextureMipLevel</th> 82<td>The mipmap level index for <SPAN class="argument">Index</SPAN> 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 <CODE>Memory::LAYOUT_BLOCK_8</CODE>.</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><CODE>ResultOutOfMemoryExt</CODE></th> 102<td>Cannot obtain memory for the data.</td> 103 </tr> 104 <tr> 105<th>ResultInvalidTextureMipLevelIndexForMipmapAutoGeneration</th> 106<td>If <SPAN class="argument">autoGenerateMipMapsFromData</SPAN> is enabled, the last mipmap level must have a resolution of 8x8 or better. Or, the last mipmap level generated must have a resolution of 32 bits or better if the pixel format is 32 or 24.</td> 107 </tr> 108 </table> </div> 109<h2>Description</h2> 110 <div class="section"> 111<p>Creates a 2D texture resource.</p><p>This function adds commands to the command list. Refer to the Programming Manual for details.</p><!-- write here --></div> 112<h2>See Also</h2> 113 <div class="section"> 114<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> 115 </div> 116<h2>Revision History</h2> 117 <div class="section"> 118 <dl class="history"> 119 <dt>2011/02/17</dt> 120<dd>Initial version.<br /> 121 </dd> 122 </dl> 123 </div> 124 <hr><p>CONFIDENTIAL</p></body> 125</html>