OldSchool Library
Low level drawing

Topics

 Basic documentation
 
 Vertex types
 

Macros

#define oslEnableTexturing()
 
#define oslDisableTexturing()
 
#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 oslSetTexture (OSL_IMAGE *img)
 Defines the current texture for low-level image drawing.
 
void oslSetTexturePart (OSL_IMAGE *img, int x, int y)
 Defines the current texture and its starting coordinates for rendering.
 
OSL_COLOR oslBlendColors (OSL_COLOR c1, OSL_COLOR c2)
 Blends two colors together.
 

Variables

int osl_currentTexWrapU
 
int osl_currentTexWrapV
 
unsigned int * osl_list
 System display list for low-level drawing operations.
 
int osl_textureEnabled
 Indicates if texturing is currently enabled.
 
void * osl_curTexture
 Current texture being used for drawing.
 
void * osl_curPalette
 Current palette being used.
 
void * osl_curDrawBuf
 Current draw buffer being used.
 
void * osl_curDispBuf
 Current display buffer being used.
 
OSL_IMAGE osl_defaultBufferImage
 Default and secondary buffers.
 
int osl_isDrawingStarted
 Flag indicating if drawing has started.
 

Detailed Description

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

Macro Definition Documentation

◆ oslEnableTexturing

#define oslEnableTexturing ( )
Value:
({ if (!osl_textureEnabled) sceGuEnable(GU_TEXTURE_2D), osl_textureEnabled = 1; })
int osl_textureEnabled
Indicates if texturing is currently enabled.

Disables texturing, making the image opaque and drawn using vertex colors.

◆ oslDisableTexturing

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

Enables texturing. This function should not be called directly; it is managed by oslSetTexture.

◆ OSL_SLICE_SIZE

#define OSL_SLICE_SIZE   64

Defines the maximum width of an image stripe for efficient drawing. Images wider than this value should be drawn in multiple stripes. For example, if the image width is 256 pixels, it should be drawn in 4 stripes, each 64 pixels wide. This prevents performance issues related to handling large images.

Enumeration Type Documentation

◆ OSL_TEXWRAP_MODES

Available values for oslSetTextureWrap.

Enumerator
OSL_TW_REPEAT 

Repeats the texture. The texture tiles indefinitely.

OSL_TW_CLAMP 

Clamps the texture. The last pixel of the texture is repeated indefinitely beyond its bounds.

Function Documentation

◆ oslVerifyStripBlit()

int oslVerifyStripBlit ( OSL_IMAGE * img)
extern

This function is intended for internal use only by oslDrawImageSimple. It is used to verify or handle strip blitting operations for images. Generally, this function manages how images are processed when they are too large to be handled in one go and need to be split into smaller strips for efficient rendering.

Do not use or modify this function directly. For details on its usage, refer to the source code of oslDrawImageSimple.

◆ oslSetTexture()

void oslSetTexture ( OSL_IMAGE * img)
extern

Defines the current texture for low-level image drawing.

This function sets the texture to be used for rendering operations. It specifies which image should be applied as a texture when drawing objects. The texture image must be in video memory (VRAM) and should be in a non-paletted format (e.g., 4444, 5551, 5650).

Parameters
imgA pointer to the OSL_IMAGE structure that represents the image to be used as the texture. The image should be loaded into video memory for proper texture mapping.
Note
  • The image must be in video memory (OSL_IN_VRAM) for the texture to be applied correctly.
  • Ensure that the image format is compatible with the texturing requirements of the GPU.
  • Calling this function changes the current texture state, so you should call it before each drawing operation if you are using different textures.

◆ oslSetTexturePart()

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

Defines the current texture and its starting coordinates for rendering.

This function sets a texture and specifies the beginning coordinates within the texture. It is useful for handling large textures by breaking them into smaller 512x512 sections.

Parameters
imgA pointer to the OSL_IMAGE structure representing the texture image. The image should be in video memory (VRAM) and should be in a non-paletted format.
xThe x-coordinate (horizontal) of the starting point within the texture, which should be a multiple of 512.
yThe y-coordinate (vertical) of the starting point within the texture, which should be a multiple of 512.

The coordinates (x, y) will be mapped to (u, v) = (0, 0) when drawing the texture, allowing access to a 512x512 portion of the texture.

◆ oslBlendColors()

OSL_COLOR oslBlendColors ( OSL_COLOR c1,
OSL_COLOR c2 )

Blends two colors together.

This function combines two colors using a blending algorithm. It is used internally and is not recommended for direct use in application code.

Parameters
c1The first color to blend.
c2The second color to blend.
Returns
The blended color result.

Variable Documentation

◆ osl_currentTexWrapU

int osl_currentTexWrapU
extern

Holds the current texture wrap state for the U coordinate.

◆ osl_currentTexWrapV

int osl_currentTexWrapV
extern

Holds the current texture wrap state for the V coordinate.

◆ osl_list

unsigned int* osl_list
extern

System display list for low-level drawing operations.

This pointer holds the address of the system's display list used for rendering graphics. It is utilized internally by OSLib for managing drawing commands and operations.

◆ osl_textureEnabled

int osl_textureEnabled
extern

Indicates if texturing is currently enabled.

This variable holds the state of the texturing feature. It is set to a non-zero value when texturing is enabled, and to zero when it is disabled. This state controls whether textures are applied to drawn objects.

◆ osl_curTexture

void* osl_curTexture
extern

Current texture being used for drawing.

This pointer holds the current texture that has been set for drawing operations. It is used internally to avoid redundant texture setting operations if the texture hasn't changed.

◆ osl_curPalette

void* osl_curPalette
extern

Current palette being used.

This pointer holds the current palette that has been set for drawing operations. It is used internally to avoid redundant palette uploads if the palette hasn't changed.

◆ osl_curDrawBuf

void* osl_curDrawBuf
extern

Current draw buffer being used.

This pointer holds the current draw buffer where drawing operations are being directed. It helps to manage the active drawing target and avoid unnecessary buffer switches.

◆ osl_curDispBuf

void* osl_curDispBuf
extern

Current display buffer being used.

This pointer holds the current display buffer that is being used for displaying the final output. It is part of the internal mechanism for managing what is shown on screen.

◆ osl_defaultBufferImage

OSL_IMAGE osl_defaultBufferImage
extern

Default and secondary buffers.

These represent the default and secondary buffers used in OSLib. The osl_defaultBufferImage is the primary buffer where the image is drawn, while osl_secondaryBufferImage is used for double buffering. osl_curBuf points to the currently active buffer.

◆ osl_isDrawingStarted

int osl_isDrawingStarted
extern

Flag indicating if drawing has started.

This flag indicates whether drawing operations have been initiated. It helps in managing and coordinating drawing processes within OSLib.