Ninja Library - Texture Function

njSetRenderWidth

Sets stride value

FORMAT

void njSetRenderWidth( nWidth )
Uint32 nWidth

PARAMETER

 nWidth  Stride value 

RETURN

None

DESCRIPTION

Sets stride value when the stride texture format is used. When stride texture is specified for rendering texture, it sets texture width size if it is smaller than the rendering area . And, it sets the rendering area width size if it is smaller than the texture size. Values set are multiples of 32 (up to 992).

EXAMPLE

void njUserInit(void)
{
  /* When render texture is used, color mode of frame buffer in sbInitSystem
   and that of texture used in render texture needs to meet
  */
 sbInitSystem( NJD_RESOLUTION_640x480_NTSCNI, NJD_FRAMEBUFFER_MODE_RGB565, 1 );
	:
 /* Reserve texture memory area by dummy */
 buff = syMalloc(512*512*2);
 
 /* Set the color according to frame buffer  Size is 512 x 512 */
 njSetTextureInfo(&info,buff,NJD_TEXFMT_STRIDE|NJD_TEXFMT_RGB_565,512,512);
 njSetTextureName(&texname[0],&info,0,NJD_TEXATTR_TYPE_MEMORY|
              NJD_TEXATTR_GLOBALINDEX);
 njInitTexture( tex, 100 );
 njLoadTexture(&texlist);
 
 /* Memory area reserved by dummy can be freed after njLoadTexture */
 syFree(buff);
 
 /* Set stride value to 512 */
 njSetRenderWidth(512);
}
Sint32 njUserMain(void)
{
	:
 /* Drawing models etc. */
 njDrawObject( OBJECT );
	:
 njSetTexture(&texlist);
 /* Renders in global index #0 */
 njRenderTextureNumG(0);
 /* Draw with rendering texture */
 njDrawTexture( poly, 4, 0,TRUE);
	:
}

REFERENCE

njRenderTextureNum()
njRenderTextureNumG()

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