-
Notifications
You must be signed in to change notification settings - Fork 1
3.5. Rolling some graphics!
First I think we should have a serious talk about Nintendo DS's video engines and modes. So there are two video engines, one for each screen. They are called the Main and Sub engine and both can be used with any of the two screens, but an engine can be assigned to at most one screen at a time. While DS hardware is capable of doing 3D graphics, we'll currently focus on the 2D graphics engine.
Each of the Main and Sub engine can render up to 4 backgrounds, called BG0, BG1, BG2 and BG3. BG3 renders first, therefore it is covered by all other backgrounds, while BG0 stays always on top, so nothing but sprites can overlap with it. Each background can draw a certain type of graphics which are specified to the engine by a video mode. Video modes are numbered from 0 to 6. You'll maybe recall the dogmatic phrase "Modes 0-2 are for text (tiled) background, while modes 3-6 are for bitmap backgrounds". Well, yes... and no. It's a bit more complex than that. It's true that video modes 3+ can display backgrounds encoded like a bitmap image (pixel by pixel), but they can also display "text"/tiled maps on some of the backgrounds.
Let's have a quick look at the main background types:
| Background type | Description |
|---|---|
| Text | A text background builds a visual map from a set of predefined square tiles of a fixed size |
| Rotation | Allows for larger size tiled backgrounds with the ability of scaling and rotation. |
| Extended Rotation | Can be either a bitmap or a tiled background, supports scaling and rotation & alpha 16-bit colors |
| Large Bitmap | Allows 1024x512px or 512x1024px sized 8bpp bitmap backgrounds |
And let's see the video modes and how they affect backgrounds:
| Mode | BG0 | BG1 | BG2 | BG3 | Main engine only |
|---|---|---|---|---|---|
| 0 | Text | Text | Text | Text | |
| 1 | Text | Text | Text | Rot | |
| 2 | Text | Text | Rot | Rot | |
| 3 | Text | Text | Text | Ex. Rot | |
| 4 | Text | Text | Rot | Ex. Rot | |
| 5 | Text | Text | Ex. Rot | Ex. Rot | |
| 6 | Large | Yes |
libnds Practical Wiki - This is an independent work of learning and exposing the facts about NDS programming. I am not affiliated in any way with Nintendo, devkitPro organization or libnds developers.