Low level drawing

Modules

 Basic documentation
 
 Vertex types
 

Macros

#define oslEnableTexturing()   ({ if (!osl_textureEnabled) sceGuEnable(GU_TEXTURE_2D), osl_textureEnabled = 1; })
 
#define oslDisableTexturing()   ({ if (osl_textureEnabled) sceGuDisable(GU_TEXTURE_2D), osl_textureEnabled = 0; })
 
#define OSL_SLICE_SIZE   64
 

Enumerations

enum  OSL_TEXWRAP_MODES { OSL_TW_REPEAT = GU_REPEAT, OSL_TW_CLAMP = GU_CLAMP }
 

Functions

int oslVerifyStripBlit (OSL_IMAGE *img)
 
void oslSetTextureWrap (int u, int v)
 
void oslSetTexture (OSL_IMAGE *img)
 
void oslSetTexturePart (OSL_IMAGE *img, int x, int y)
 
OSL_COLOR oslBlendColor (OSL_COLOR c)
 

Variables

int osl_currentTexWrapU
 
int osl_currentTexWrapV
 
unsigned int * osl_list
 
int osl_textureEnabled
 

Detailed Description

Low level drawing routines, nearer to the hardware and thus faster.

Macro Definition Documentation

#define oslEnableTexturing ( )    ({ if (!osl_textureEnabled) sceGuEnable(GU_TEXTURE_2D), osl_textureEnabled = 1; })

Disables texturing (the image will be drawn opaque using vertex colors).

#define oslDisableTexturing ( )    ({ if (osl_textureEnabled) sceGuDisable(GU_TEXTURE_2D), osl_textureEnabled = 0; })

Enables texturing. You should not call this function by yourself, as oslSetTexture does it by itself.

#define OSL_SLICE_SIZE   64

Don't forget about stripping when you're drawing images by yourself, else it will be slower! The thing to know is: never draw an image wider than 64 pixels. If the image is, say, 256 pixels wide, you can draw it in 4 stripes of 64 each (setting u, v coordinates to 0, 64, 128, 192, etc.).

Enumeration Type Documentation

Available values for oslSetTextureWrap.

Enumerator
OSL_TW_REPEAT 

Repeats the texture.

OSL_TW_CLAMP 

Clamps the texture (the last image pixel is repeated indefinitely).

Function Documentation

int oslVerifyStripBlit ( OSL_IMAGE img)

Don't use it! It's internally used by oslDrawImageSimple. Look at the source code for more information.

void oslSetTextureWrap ( int  u,
int  v 
)
inline

Sets the behaviour of images when their bounds are reached. For example let's say you have a 128x128 image and you draw a 200x200 region. This is larger than the image itself and thus the part to the left or the right will be either repeated or clamped depending on the parameter.

Parameters
u,vOSL_TW_CLAMP: Clamp (the same pixel is repeated indefinitely) OSL_TW_REPEAT: The image texture is tiled.
void oslSetTexture ( OSL_IMAGE img)

Defines the current texture, useful for low level image drawing.

void oslSetTexturePart ( OSL_IMAGE img,
int  x,
int  y 
)

Same but also defines the beginning coordinate in the texture. Useful for tricks meant to display an image bigger than 512x512.

Parameters
imgTexture to set
x,yBeginning (top-left corner) of the image. Should be a multiple of 512. The (x, y) corner will become the (u, v) = (0, 0) coordinate when drawing a texture, and a 512x512 range (to the right and down) will be accessible.
OSL_COLOR oslBlendColor ( OSL_COLOR  c)
inline

Applies the alpha parameters to a color, tinting it. This is needed as alpha is not applied to vertex color but only to textures.

Variable Documentation

int osl_currentTexWrapU

Holds the current texture wrap state (see oslSetTextureWrap).

int osl_currentTexWrapV

Same for the v state.

unsigned int* osl_list

System display list.

int osl_textureEnabled

Holds whether texturing is currently enabled.