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>glFramebufferTexture2D</title> 8 </head> 9 <body> 10<h1>glFramebufferTexture2D Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14GL_APICALL void GL_APIENTRY glFramebufferTexture2D( 15 GLenum target, 16 GLenum attachment, 17 GLenum textarget, 18 GLuint texture, 19 GLint level 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>target</th> 36<td>Target framebuffer</td> 37 </tr> 38 <tr> 39<td>in</td> 40<th>attachment</th> 41<td>Attachment point</td> 42 </tr> 43 <tr> 44<td>in</td> 45<th>textarget</th> 46<td>Target texture.</td> 47 </tr> 48 <tr> 49<td>in</td> 50<th>texture</th> 51<td>Texture object</td> 52 </tr> 53 <tr> 54<td>in</td> 55<th>level</th> 56<td>Mipmap level</td> 57 </tr> </table> 58 </div> 59<h2>Return Values</h2> 60<div class="section">There is no return value. </div> 61<h2>Description</h2> 62 <div class="section"> 63<p>Attaches a texture to the current framebuffer.</p><P> 64You can render to attached textures. 65 </P><P> 66You must specify a value of <code>GL_FRAMEBUFFER</code> for the <span class="argument">target</span> argument. 67 </P><P> 68Specify a value of <CODE>GL_COLOR_ATTACHMENT0</CODE>, <CODE>GL_DEPTH_ATTACHMENT</CODE>, or <CODE>GL_DEPTH_STENCIL_ATTACHMENT</CODE> for the <SPAN class="argument">attachment</SPAN> argument. 69 </P><P> 70Set <span class="argument">textarget</span> to one of the following values. 71<TABLE><TR><TH><CODE>GL_TEXTURE_2D</CODE></TH><TD>2D texture</TD></TR><TR><TH><CODE>GL_TEXTURE_CUBE_MAP_NEGATIVE_X</CODE></TH><TD>Cube-map texture (face where x < 0)</TD></TR><TR><TH><CODE>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</CODE></TH><TD>Cube-map texture (face where y < 0)</TD></TR><TR><TH><CODE>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</CODE></TH><TD>Cube-map texture (face where z < 0)</TD></TR><TR><TH><CODE>GL_TEXTURE_CUBE_MAP_POSITIVE_X</CODE></TH><TD>Cube-map texture (face where x > 0)</TD></TR><TR><TH><CODE>GL_TEXTURE_CUBE_MAP_POSITIVE_Y</CODE></TH><TD>Cube-map texture (face where y > 0)</TD></TR><TR><TH><CODE>GL_TEXTURE_CUBE_MAP_POSITIVE_Z</CODE></TH><TD>Cube-map texture (face where z > 0)</TD></TR></TABLE><!-- source textargetにはGL_TEXTURE_2D、GL_TEXTURE_CUBE_MAP_NEGATIVE_X、GL_TEXTURE_CUBE_MAP_NEGATIVE_Y、GL_TEXTURE_CUBE_MAP_NEGATIVE_Z、 GL_TEXTURE_CUBE_MAP_POSITIVE_X、GL_TEXTURE_CUBE_MAP_POSITIVE_Y、GL_TEXTURE_CUBE_MAP_POSITIVE_Zを指定します。 --></P><P> 72Set <span class="argument">texture</span> to the texture object to attach. You can specify a texture allocated in main memory using <CODE>NN_GX_MEM_FCRAM</CODE> with <CODE>glTexImage2D</CODE>, but hardware specifications do not allow it to be cleared by the <CODE>glClear</CODE> function. Rendering to main memory makes it easy for bus conflicts to occur and is less efficient than using textures allocated in VRAM. 73 </P><P> 74Specify 0 for <span class="argument">level</span>. 75 </P><P> 76Only textures of the following formats can be attached to a depth attachment point. 77<TABLE><TR><TH>Depth Buffer Format</TH><TH>Depth Buffer Content</TH><TH>Corresponding Texture Format (Texture Type)</TH></TR><TR><TD><CODE>GL_DEPTH24_STENCIL8_EXT</CODE></TD><TD>R: 8-bit stencil value<BR />G: 24-bit depth value, bits [23:16]<BR />B: 24-bit depth value, bits [15:8]<BR />A: 24-bit depth value, bits [7:0]</TD><TD><CODE>GL_RGBA</CODE> (<CODE>GL_UNSIGNED_BYTE</CODE>), <CODE>GL_RGBA_NATIVE_DMP</CODE> (<CODE>GL_UNSIGNED_BYTE</CODE>)</TD></TR><TR><TD><CODE>GL_DEPTH_COMPONENT24_OES</CODE></TD><TD>R: 24-bit depth value, bits [23:16]<BR />G: 24-bit depth value, bits [15:8]<BR />B: 24-bit depth value, bits [7:0]</TD><TD><CODE>GL_RGB</CODE> (<CODE>GL_UNSIGNED_BYTE</CODE>), <CODE>GL_RGB_NATIVE_DMP</CODE> (<CODE>GL_UNSIGNED_BYTE</CODE>)</TD></TR><TR><TD><CODE>GL_DEPTH_COMPONENT16</CODE></TD><TD>R: 16-bit depth value, bits [15:8]<BR />G: 16-bit depth value, bits [7:0]</TD><TD><CODE>GL_HILO8_DMP</CODE> (<CODE>GL_UNSIGNED_BYTE</CODE>), <CODE>GL_HILO8_NATIVE_DMP</CODE> (<CODE>GL_UNSIGNED_BYTE</CODE>)</TD></TR></TABLE> 78Call this function with a value of <CODE>GL_DEPTH_ATTACHMENT</CODE> for the <SPAN class="argument">attachment</SPAN> argument to attach one of the above formats. The texture format RGBA values are used for other formats including the stencil. You can also call this function with a value of <CODE>GL_DEPTH_STENCIL_ATTACHMENT</CODE> for the <SPAN class="argument">attachment</SPAN> argument, but the end result is the same. 79 </P><P> 80The following errors occur in this function. 81<TABLE><TR><TH><CODE>GL_INVALID_ENUM</CODE></TH><TD>The <span class="argument">target</span> or <span class="argument">textarget</span> argument was set to an invalid value.</TD></TR><TR><TH><CODE>GL_INVALID_VALUE</CODE></TH><TD>Both <span class="argument">texture</span> and <span class="argument">level</span> are nonzero.</TD></TR><TR><TH><CODE>GL_INVALID_OPERATION</CODE></TH><TD>The <SPAN class="argument">texture</SPAN> argument was set equal to a nonexistent texture object.</TD></TR><TR><TH><CODE>GL_INVALID_OPERATION</CODE></TH><TD>The <span class="argument">texture</span> argument was bound to <code>GL_TEXTURE_2D</code> by <code>glBindTexture</code> but <span class="argument">textarget</span> is not <code>GL_TEXTURE_2D</code>.</TD></TR><TR><TH><CODE>GL_INVALID_OPERATION</CODE></TH><TD>The <span class="argument">texture</span> argument was bound to <code>GL_TEXTURE_CUBE_MAP</code> by <code>glBindTexture</code> but <span class="argument">textarget</span> is not <code>GL_TEXTURE_CUBE_MAP_XXX</code>.</TD></TR></TABLE><!-- source target、textargetに不正な値を指定した場合エラーGL_INVALID_ENUMを生成します。 PODではカレントのフレームバッファに0がバインドされている場合エラーGL_INVALID_OPERATIONを生成します。 textureが0でない、かつlevelが0でない場合エラーGL_INVALID_VALUEを生成します。 (textureが0の場合、levelは無視されます。) textureで指定したテクスチャオブジェクトが存在しない場合エラーGL_INVALID_OPERATIONを生成します。 textureがglBindTextureによりGL_TEXTURE_2Dにバインドされており、textargetがGL_TEXTURE_2Dではない場合エラーGL_INVALID_OPERATIONを生成します。 textureがglBindTextureによりGL_TEXTURE_CUBE_MAPにバインドされており、textargetがGL_TEXTURE_CUBE_MAP_XXXではない場合エラーGL_INVALID_OPERATIONを生成します。 --></P></div> 82<h2>Revision History</h2> 83 <div class="section"> 84 <dl class="history"> 85 <dt>2010/08/12</dt> 86<dd>Explained support of depth attachment points. Explained deprecation of limits on where rendering target textures can be allocated. Deleted description of errors occurring only for POD.<br /> 87 </dd> 88 <dt>2010/05/12</dt> 89<dd>Fixed typos and added supplementary information on the placement of texture object data.<br /> 90 </dd> 91 <dt>2010/01/07</dt> 92<dd>Initial version.<br /> 93 </dd> 94 </dl> 95 </div> 96 <hr><p>CONFIDENTIAL</p></body> 97</html>