Video interface system for configuring video output modes and displaying rendered graphics.
More...
|
void | display_init (resolution_t res, bitdepth_t bit, uint32_t num_buffers, gamma_t gamma, antialias_t aa) |
| Initialize the display to a particular resolution and bit depth. More...
|
|
void | display_close () |
| Close the display. More...
|
|
surface_t * | display_lock (void) |
| Lock a display buffer for rendering. More...
|
|
void | display_show (surface_t *surf) |
| Display a previously locked buffer. More...
|
|
uint32_t | display_get_width (void) |
| Get the currently configured width of the display in pixels.
|
|
uint32_t | display_get_height (void) |
| Get the currently configured height of the display in pixels.
|
|
uint32_t | display_get_bitdepth (void) |
| Get the currently configured bitdepth of the display (in bytes per pixels)
|
|
uint32_t | display_get_num_buffers (void) |
| Get the currently configured number of buffers.
|
|
|
const resolution_t | RESOLUTION_256x240 = {256, 240, false} |
| 256x240 mode
|
|
const resolution_t | RESOLUTION_320x240 = {320, 240, false} |
| 320x240 mode
|
|
const resolution_t | RESOLUTION_512x240 = {512, 240, false} |
| 512x240 mode, high-res progressive
|
|
const resolution_t | RESOLUTION_640x240 = {640, 240, false} |
| 640x240 mode, high-res progressive
|
|
const resolution_t | RESOLUTION_512x480 = {512, 480, true} |
| 512x480 mode, interlaced
|
|
const resolution_t | RESOLUTION_640x480 = {640, 480, true} |
| 640x480 mode, interlaced
|
|
Video interface system for configuring video output modes and displaying rendered graphics.
The display subsystem handles interfacing with the video interface (VI) and the hardware rasterizer (RDP) to allow software and hardware graphics operations. It consists of the Display Subsystem, the 2D Graphics and the Hardware Display Interface modules. A separate module, the Console Support, provides a rudimentary console for developers. Only the display subsystem or the console can be used at the same time. However, commands to draw console text to the display subsystem are available.
The display subsystem module is responsible for initializing the proper video mode for displaying 2D, 3D and software graphics. To set up video on the N64, code should call display_init with the appropriate options. Once the display has been set, a surface can be requested from the display subsystem using display_lock. To draw to the acquired surface, code should use functions present in the 2D Graphics and the Hardware Display Interface modules. Once drawing to a surface is complete, the rendered graphic can be displayed to the screen using display_show. Once code has finished rendering all graphics, display_close can be used to shut down the display subsystem.
◆ resolution_t
Video resolution structure.
You can either use one of the pre-defined constants (such as RESOLUTION_320x240) or define a custom resolution.
Data Fields |
int32_t |
width |
Screen width (must be between 1 and 800) |
int32_t |
height |
Screen height (must be between 1 and 600) |
bool |
interlaced |
True if interlaced mode enabled. |
◆ display_context_t
◆ bitdepth_t
Valid bit depths.
Enumerator |
---|
DEPTH_16_BPP | 16 bits per pixel (5-5-5-1)
|
DEPTH_32_BPP | 32 bits per pixel (8-8-8-8)
|
◆ gamma_t
Valid gamma correction settings.
Enumerator |
---|
GAMMA_NONE | Uncorrected gamma.
|
GAMMA_CORRECT | Corrected gamma.
|
GAMMA_CORRECT_DITHER | Corrected gamma with hardware dither.
|
◆ antialias_t
Valid antialiasing settings.
Enumerator |
---|
ANTIALIAS_OFF | No anti-aliasing.
|
ANTIALIAS_RESAMPLE | Resampling anti-aliasing.
|
ANTIALIAS_RESAMPLE_FETCH_NEEDED | Anti-aliasing and resampling with fetch-on-need.
|
ANTIALIAS_RESAMPLE_FETCH_ALWAYS | Anti-aliasing and resampling with fetch-always.
|
◆ display_init()
Initialize the display to a particular resolution and bit depth.
Initialize video system. This sets up a double, triple, or multiple buffered drawing surface which can be blitted or rendered to using software or hardware.
- Parameters
-
[in] | res | The requested resolution. Use either one of the pre-defined resolution (such as RESOLUTION_320x240) or define a custom one. |
[in] | bit | The requested bit depth (DEPTH_16_BPP or DEPTH_32_BPP) |
[in] | num_buffers | Number of buffers, usually 2 or 3, but can be more. Triple buffering is recommended in case the application cannot hold a steady full framerate, so that slowdowns don't impact too much. |
[in] | gamma | The requested gamma setting |
[in] | aa | The requested anti-aliasing setting |
◆ display_close()
Close the display.
Close a display and free buffer memory associated with it.
◆ display_lock()
Lock a display buffer for rendering.
Grab a surface that is safe for drawing. If none is available then this will return 0, without blocking.
When you are done drawing on the buffer, use display_show to unlock the surface and schedule the buffer to be displayed on the screen during next vblank.
It is possible to lock more than a display buffer at the same time, for instance to begin working on a new frame while the previous one is still being rendered in parallel through RDP. It is important to notice that surfaces will always be shown on the screen in locking order, irrespective of the order display_show is called.
- Returns
- A valid surface to render to or NULL if none is available.
◆ display_show()
Display a previously locked buffer.
Display a previously-locked surface to the screen on the next vblank. The surface should be locked via display_lock.
This function does not accept any arbitrary surface, but only those returned by display_lock.
- Parameters
-
[in] | surf | A surface to show (previously retrieved using display_lock) |