Available Graphics Samples
rsxtest
Basic 3D rendering with vertex and fragment shaders
rsxtest_spu
RSX rendering with SPU-assisted vertex processing
cairo
2D vector graphics using Cairo library
pngtest
PNG image loading and display
jpgtest
JPEG image loading and display
blitting
Surface blitting and buffer operations
rsxtest_dl
Display list based rendering
rsxtest_flip
Buffer flipping and vsync
rsxtest - 3D Graphics Fundamentals
Location:samples/graphics/rsxtest/
Demonstrates complete 3D rendering pipeline with diffuse and specular lighting.
What It Demonstrates
- RSX context initialization
- Vertex and fragment shader loading
- 3D mesh creation (sphere, donut, cube)
- Texture mapping
- Lighting calculations (diffuse + specular)
- Double buffering and vsync
Key Code: Initialization
samples/graphics/rsxtest/source/main.cpp
Drawing Pipeline
The rendering process:Shader Setup
rsxtest_spu - SPU-Assisted Graphics
Location:samples/graphics/rsxtest_spu/
Combines RSX rendering with SPU vertex processing for improved performance.
What It Demonstrates
- SPU vertex transformation
- PPU-SPU data transfer
- Workload distribution
- Parallel processing benefits
cairo - 2D Vector Graphics
Location:samples/graphics/cairo/
Shows how to use the Cairo graphics library for 2D drawing.
What It Demonstrates
- Cairo surface creation
- Vector drawing primitives
- Rotation and transformation
- Real-time FPS display
Drawing with Cairo
samples/graphics/cairo/source/main.c
Image Loading Samples
pngtest - PNG Images
Location:samples/graphics/pngtest/
Loads and displays PNG images using libpng.
jpgtest - JPEG Images
Location:samples/graphics/jpgtest/
Loads and displays JPEG images using libjpeg.
Building Graphics Samples
Build All Graphics Samples
Build Individual Sample
Clean
Common Patterns
RSX Initialization
Screen and context setup
Screen and context setup
Shader loading
Shader loading
Vertex binding
Vertex binding
Buffer Management
Performance Tips
Use RSX memory for frequently accessed data
Use RSX memory for frequently accessed data
Allocate vertex buffers, textures, and shader code in RSX memory using
rsxMemalign() for best performance.Minimize state changes
Minimize state changes
Group draw calls with similar render states together to reduce overhead.
Consider SPU assistance
Consider SPU assistance
For complex vertex processing, offload work to SPUs as shown in
rsxtest_spu.Use appropriate precision
Use appropriate precision
Use half-precision floats in shaders where full precision isn’t needed.
Related Documentation
RSX API Reference
Complete RSX graphics API documentation
Graphics Guide
In-depth graphics programming concepts
Shader Programming
Writing vertex and fragment shaders
SPU Samples
SPU programming for graphics acceleration