GX Demos

# Graphics Sample Demos

## Location

`$NitroSDK/build/demos/gx/UnitTours`

All of the graphics sample demos use `DEMO.h` and `libDEMO.a`, which are found in `$NitroSDK/build/demos/gx/UnitTours/DEMOLib`.

## Compilation

Move to the `$NitroSDK/build/demos/gx/UnitTours` directory and enter:

> `% make`

Executable (`.nef`, `.srl`) files will be generated in

> `$NitroSDK/build/demos/gx/UnitTours/sample_name/bin/platform/target/`

For example:

> `$NitroSDK/build/demos/gx/UnitTours/2D_Oam_1/bin/ARM9-TS/Release/`

## Execution

Navigate to the directory `$NitroSDK/build/demos/gx/UnitTours/sample_name/bin/platform/target/` and perform one of the following:

- Execute `*.nef`, `*.srl` with ensata.
- Load and execute a `*.nlf` file with IS-NITRO-DEBUGGER.
- Execute a `*.srl` file with IS-NITRO-DEBUGGER

## Description

#### BG Samples

`2D_CharBg_1` | Displays BG in text mode.
`2D_CharBg_2` | Displays BG in affine mode. You can rotate the screen with key operations.
`2D_CharBg_3` | Displays BG in affine mode. You can scale the screen with key operations.
`2D_CharBg_4` | Sets an offset to BG. You can scroll the screen with key operations.
`2D_CharBg_5` | Flips each BG character. You can flip each screen character with key operations.
`2D_CharBg_6` | Applies a mosaic to BG. You can change the size of the mosaic with key operations.
`2D_CharBg_7` | Alpha blends 2 BGs. You can adjust the blending coefficient with key operations.
`2D_CharBg_8` | Displays 2 windows. You can change window position and size with key operations.
`2D_CharBg_9` | Sets BG brightness. You can change brightness with key operations.
`2D_CharBg_256_16` | Displays a screen using the affine extension BG, 256 color x 16 palette.
`2D_CharBg_256BMP` | Displays a screen using the affine-expanded, 256-color, bit-mapped BG.
`2D_CharBg_Direct` | Displays a screen using the affine extension BG, direct color bit mapped BG.
`2D_BmpBg_Vram` | Displays a screen using VRAM display mode.
`2D_BmpBg_MainRam` | Displays a screen using main memory display mode.
`2D_CharBg_BankEx` | Displays screen, directly specifying BG-VRAM with `GX_SetBankForBGEx`.

#### OBJ Samples

`2D_Oam_1` | Displays an OBJ.
`2D_Oam_2` | Rotates an OBJ using affine mode. You can rotate an OBJ with key operations.
`2D_Oam_3` | Scales an OBJ using affine doubling mode. You can enlarge and reduce an OBJ with key operations.
`2D_Oam_4` | Flips an OBJ. You can flip an OBJ with key operations.
`2D_Oam_5` | Applies a mosaic to an OBJ. You can change the size of the mosaic with key operations.
`2D_Oam_256_16` | Displays a 256 color x 16 extended palette OBJ.
`2D_Oam_Direct` | Displays a 2D mapping bit mapped OBJ.
`2D_Oam_Bmp1D` | Displays a 1D mapping bitmapped OBJ.
`2D_Oam_Char1D` | Displays a 1D mapping character OBJ.
`2D_Oam_Translucent` | Displays a translucent OBJ. Key operations can change the translucent OBJ's blending factor.
`2D_Oam_OBJWindow` | Displays a background BG through a circular OBJ window. Key operations can move the OBJ window.

#### 3D Samples

`3D_Pol_OneTri` | Displays one triangle on the screen.
`3D_Pol_Simple` | Displays a rotating cube without light and vertex color.
`3D_Pol_Simple2` | Displays a cube and uses the `G3_VtxXY`, `G3_VtxXZ`, and `G3_VtxYZ` functions.
`3D_Pol_Simple3` | Displays a cube and uses the `G3_Vtx10` function.
`3D_Pol_Color` | Displays a cube using the `G3_Color` function to set vertex color.
`3D_Pol_Light` | Displays a cube using the `G3_Normal` function to set normal vectors.
`3D_Pol_LightColor` | Shows the difference in the display when changing the order of the `G3_Color` and the `G3_Normal` functions.
`3D_Pol_Tex4_Plett` | Applies a 4-color palette texture to a cube and displays it.
`3D_Pol_Tex16_Plett` | Applies a 16-color palette texture to a cube and displays it.
`3D_Pol_Tex256_Plett` | Applies a 256-color palette texture to a cube and displays it.
`3D_Pol_Tex32768` | Applies a direct texture to a cube and displays it.
`3D_Pol_Tex4x4` | Applies a 4x4 texel compressed texture to a cube and displays it.
`3D_Pol_Tex_Alpha` | Applies a translucent texture to a cube and displays it.
`3D_Pol_Tex_Decal` | Applies a texture in decal mode to a cube and displays it.
`3D_Pol_Toon` | Displays a chair using toon shading.
`3D_Pol_High_Light` | Displays a chair using highlight shading.
`3D_Pol_TexSRT` | Specifies a TexCoord source with the `G3_TexImageParam` function, and then scales, rotates, and translates the texture.
`3D_Pol_Env_Mapping` | Specifies a Normal source with the `G3_TexImageParam` function, and then displays an environment map.
`3D_Pol_Vertex_Source` | Specifies a Vertex source with the `G3_TexImageParam` function, and then displays a projection map.
`3D_Pol_Translucent` | Displays translucent polygons.
`3D_Pol_Transparent` | Displays transparent polygons (wireframe display).
`3D_Shininess` | Sets a specular reflection brightness table, and converts specular reflection brightness.
`3D_Fog` | Moves a cube in a space to which fog has been applied.
`3D_Edge_Marking` | Performs different edge marking on each of three cubes, and then displays them.
`3D_Alpha_Test` | Performs an alpha test. Although two cubes are drawn, only one is displayed.
`3D_Command_Pack` | DMA transfers a previously prepared command list (display list), and displays a model.
`3D_Pol_MakeDL` | Dynamically generates a command list (display list) in the program and displays a model.
`3D_Pol_Split` | Displays a cube on both screens by switching output display during H-Blanks.
`3D_PolAttr_1Dot` | Uses `MISC_DISP_1DOT` in the `G3_PolygonAttr` function to control the display of 1-dot polygons. Key operations toggle the display of 1-dot polygons ON/OFF.
`3D_PolAttr_DpthTest` | Uses `MISC_DEPTHTEST_DECAL` in the `G3_PolygonAttr` function to control the display of decal polygons. Key operations toggle the effect ON/OFF.
`3D_PolAttr_DpthUpdate` | Uses `MISC_XLU_DEPTH_UPDATE` in the `G3_PolygonAttr` function to update the depth buffer used when rendering translucent polygons. Key operations toggle the effect ON/OFF.
`3D_PolAttr_FARClip` | Clips polygons that intersect the FAR plane defined in the `G3_PolygonAttr` function. Key operations move the far plane and toggle the effect ON/OFF.
`3D_Shadow_Pol` | Displays a shadow using shadow polygons.
`3D_BoxTest` | Performs a box test. Switches between normal rendering and wireframe rendering by determining whether the rotating, moving sphere touches the surface of a cube.
`AntiAlias` | Antialiases polygons.
`FlipRepeat` | Sets flip and repeat for a texture and displays it. Key operations change the settings.
`ClearColor` | Sets the clear color and sets the inital value for the color buffer.
`ClearImage` | Uses a clear image to set an image in the clear color buffer's initial value, and displays it.
`ClearDepthOnly` | Without setting VRAM to the clear color image slot, uses only the clear depth image. At this time, all clear colors are initialized to 0.
`CurrentMtx` | Acquires the current clip matrix and displays it in debug output.
`PosVecTest` | Acquires and displays in debug output both the position coordinates transformed by the current clip coordinate matrix and the vectors transformed by the current direction vector matrix.
`LinesOver` | Detects lines over and displays in debug output.
`RamOverFlow` | Detects polygon list RAM and vertex list RAM overflow and displays them in debug output.
`ViewPort` | Sets and displays the viewport. Key operations can change the viewport size and position.

#### Samples Using Screen Effects

`MasterBright` | Displays a screen using the special effect brightness up/down. Key operations can change the screen brightness.
`Capture` | Displays a motion blur effect using the screen capture feature.
`Window` | Changes the shape of the window display using H-blank interrupts.
`Window_HDMA` | Changes the shape of the window display using H-blank auto-start DMA.
`VCount` | Changes the number of lines in a frame by changing VCount values. Key operations can change the number of lines rendered in a frame.

#### Samples Using the Sub Graphics Engine and the Bottom LCD

`Sub_CharBg_1` | The same operation as for `2D_CharBg_1` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_2` | The same operation as for `2D_CharBg_2` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_3` | The same operation as for `2D_CharBg_3` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_4` | The same operation as for `2D_CharBg_4` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_5` | The same operation as for `2D_CharBg_5` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_6` | The same operation as for `2D_CharBg_6` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_7` | The same operation as for `2D_CharBg_7` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_8` | The same operation as for `2D_CharBg_8` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_CharBg_9` | The same operation as for `2D_CharBg_9` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_Oam_1` | The same operation as for `2D_Oam_1` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_Oam_2` | The same operation as for `2D_Oam_2` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_Oam_3` | The same operation as for `2D_Oam_3` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_Oam_4` | The same operation as for `2D_Oam_4` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_Oam_5` | The same operation as for `2D_Oam_5` is carried out for the sub graphics engine and displayed on the Bottom LCD.
`Sub_Double3D` | The display of 3D on both screens is mimicked by using capture.

## Emulator

`3D_Pol_Transparent` does not function properly.

## See Also

`Graphics Function List`

## Revision History

2006/02/27 Corrected the mistaken description of 2D_CharBg_256BMP.
07/22/2005 Corrected sample demo names.
05/10/2005 Added description of `2D_CharBg_BankEx` demo.
03/02/2005 Revised descriptions to reflect current support environment conditions.
08/17/2004 Standardized the notation of the IS-NITRO-EMULATOR.
07/10/2004 Change from `.bin` to `.srl.`
02/20/2004 Added Samples using the Sub Graphics Engine and the Bottom LCD.
01/09/2004 Initial version.

CONFIDENTIAL