CTR graphics are implemented by generating lists of GPU commands and using the lists to operate the GPU. (GPU commands are called 3D commands and command requests.) The graphics libraries can be broadly grouped into those that control command lists and those that generate the commands to actually render images.
Use the GX (nngx) library for low-level operations such as controlling command lists or display buffers. No matter what approach you use, you must use this library.
When it comes to generating the 3D rendering commands, however, you can choose between the GL, GD, GR, and NW4C libraries. Alternately, applications can directly generate 3D commands.
The following sections describe each command generation method. This information will help you select the best method or combination of methods for your purposes.
This is the CTR basic graphics library. This library offers a rich feature set, including OpenGL ES-compatible API functions, error handling, and state change management. This library entails a heavier processing load than the others, with a substantial CPU load. We recommend not using this library if performance is a concern.
This is a lightweight library compared to GL.
It provides the same functionality as the GL library, but the API is in a form that is easier for developers to handle. (Note that it is not compatible with GL.)
A certain load on the CPU is required for purposes of internal processing.
This graphics library supports the direct generation of 3D commands. This library does not manage states internally, making it faster than the GL or GD libraries and also reducing the amount of memory required. Using it requires detailed knowledge of how to set each GPU register, however, as described in the System API Specifications. It is also more difficult to implement because users must handle error checks and other details.
The NW4C library, which serves as Nintendo's application development middleware, handles both graphics and sound. The NW4C graphics features generate internal commands rather than using other graphics libraries. This implementation means that it can be used on its own to achieve optimized performance. See the NintendoWare for CTR package and documentation for details.
You can directly generate the register write commands applied to the GPU. Generating only the required commands can boost operating speeds. This is the most difficult method to implement, however, because it requires detailed knowledge of how to set each GPU register. (Register settings are explained in the System API Specifications.) We therefore recommend using the GR library, which is implemented to support direct command generation.
The CTR-SDK only implements the vertex shader as a programmable shader.
The vertex shader is coded in an assembly language using PICA-specific specifications.
For details, see the reference manual for the vertex shader. See the list of vertex shader instructions for the ones available on the CTR system.
CONFIDENTIAL