Ninja Library - Texture Function

njRenderTextureNumG

Renders at the texture area

FORMAT

void njRenderTextureNumG( globalIndex )
Uint32 globalIndex

PARAMETER

 globalIndex  Global index number 

RETURN

None

DESCRIPTION

Renders at the texture specified by globalIndex. Textures that can render are either NJD_TEXFMT_RECTANGLE or NJD_TEXFMT_STRIDE. If texture area is smaller than the screen, it adjusts to the upper left and performs rendering. Stride value must be set by njSetRenderWidth() function when NJD_TEXFMT_STRIDE. Normally, the stride value is the same as rendering area width.

EXAMPLE

void njUserInit(void)
{
 /* When render texture is used, set njInitSystem frame buffer color mode
    with the texture color mode used for render texture.
 */
 sbInitSystem( NJD_RESOLUTION_640x480_NTSCNI, NJD_FRAMEBUFFER_MODE_RGB565, 1 );
 
	:
 /* Reserve texture memory area with dummy  */
 buff = syMalloc(512*512*2);
 /* Set color the same as the frame buffer color, and size to 512x512 */
 njSetTextureInfo(&info,buff,NJD_TEXFMT_RECTANGLE|NJD_TEXFMT_RGB_565,512,512);
 njSetTextureName(&texname[0],&info,0,NJD_TEXATTR_TYPE_MEMORY|
              NJD_TEXATTR_GLOBALINDEX);
 njInitTexture( tex, 100 );
 njLoadTexture(&texlist);
 

 /* Reserved dummy area can be released after the njLoadTexture() function  */
 syFree(buff);
}
Sint32 njUserMain(void)
{
	:
 
 /* Draw models etc. */
 njDrawObject( OBJECT );
	:
 
 njSetTexture(&texlist);
 /* Renders to the global index number 0 */
 njRenderTextureNumG(0);
 /* Draw using rendered textures */
 njDrawTexture( poly, 4, 0,TRUE);
	:
}

NOTE

Rendering to texture area means that it is totally two times to perform rendering in addtion to normal rendering to the frame buffer. Refer to texture document for more details.

njRenderTextureNumG
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999