OldSchool Library 1.6.0
Loading...
Searching...
No Matches
Basic documentation

This section provides basic guidance on drawing textured and untextured objects, assuming some familiarity with GU (Graphics Utility).

Here's a basic example of drawing a textured object and an untextured object:

void drawSomethingTextured(OSL_IMAGE *img) {
// Define the vertices for your shape. Sprites use 2 vertices, triangles use 3, and quads use 4.
VERTEX_TYPE *vertices;
// Set the provided image as the current texture
// Allocate memory for the vertices
vertices = (VERTEX_TYPE*)sceGuGetMemory(NUMBER_OF_VERTICES * sizeof(vertices[0]));
// Initialize the vertex data
vertices[0].something = ...;
// [Additional vertex data setup]
// Draw the array of vertices using GU (Graphics Utility)
sceGuDrawArray(PRIMITIVETYPE, VERTEX_DESCRIPTION | GU_TRANSFORM_2D, NUMBER_OF_VERTICES, 0, vertices);
}
void drawSomethingUntextured(OSL_IMAGE *img) {
// Define the vertices for your shape. Sprites use 2 vertices, triangles use 3, and quads use 4.
VERTEX_TYPE *vertices;
// Disable texturing
// Allocate memory for the vertices
vertices = (VERTEX_TYPE*)sceGuGetMemory(NUMBER_OF_VERTICES * sizeof(vertices[0]));
// Initialize the vertex data
vertices[0].something = ...;
// [Additional vertex data setup]
// Draw the array of vertices using GU
sceGuDrawArray(PRIMITIVETYPE, VERTEX_DESCRIPTION | GU_TRANSFORM_2D, NUMBER_OF_VERTICES, 0, vertices);
}
#define oslDisableTexturing()
Definition drawing.h:3230
void oslSetTexture(OSL_IMAGE *img)
Defines the current texture for low-level image drawing.
Structure representing an image loaded in memory.
Definition drawing.h:929

As you can see, drawing with GU is straightforward if you are familiar with it. For those new to GU, it is recommended to review the samples of the PSP SDK (https://github.com/pspdev/pspsdk) for a deeper understanding.