libnds
|
Video API vaguely similar to OpenGL. More...
#include <nds/arm9/cache.h>
#include <nds/arm9/dynamicArray.h>
#include <nds/arm9/math.h>
#include <nds/arm9/sassert.h>
#include <nds/arm9/trig_lut.h>
#include <nds/arm9/video.h>
#include <nds/dma.h>
#include <nds/ndstypes.h>
Data Structures | |
struct | GLvector |
Holds a vector. More... | |
struct | m3x3 |
Holds a 3x3 matrix. More... | |
struct | m4x3 |
Holds a 4x3 matrix. More... | |
struct | m4x4 |
Holds a 4x4 matrix. More... | |
Macros | |
#define | f32tot16(n) ((t16)(n >> 8)) |
Convert f32 to t16. | |
#define | f32tov10(n) ((v10)((n) >> 3)) |
Convert f32 to v10. | |
#define | f32tov16(n) (n) |
Convert f32 to v16. | |
#define | FIFO_BEGIN REG2ID(GFX_BEGIN) |
Starts a polygon vertex list. | |
#define | FIFO_CLEAR_COLOR REG2ID(GFX_CLEAR_COLOR) |
Clear color of the rear plane. | |
#define | FIFO_CLEAR_DEPTH REG2ID(GFX_CLEAR_DEPTH) |
Depth of the rear plane. | |
#define | FIFO_COLOR REG2ID(GFX_COLOR) |
Direct vertex color. | |
#define | FIFO_COMMAND_PACK(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1)) |
Packs four packed commands into a 32bit command for sending to the GFX FIFO. | |
#define | FIFO_DIFFUSE_AMBIENT REG2ID(GFX_DIFFUSE_AMBIENT) |
Diffuse and ambient material properties for the following vertices. | |
#define | FIFO_END REG2ID(GFX_END) |
Ends a polygon vertex list. | |
#define | FIFO_FLUSH REG2ID(GFX_FLUSH) |
Flush the 3D context. | |
#define | FIFO_LIGHT_COLOR REG2ID(GFX_LIGHT_COLOR) |
Color for a light source. | |
#define | FIFO_LIGHT_VECTOR REG2ID(GFX_LIGHT_VECTOR) |
Direction of a light source. | |
#define | FIFO_NOP REG2ID(GFX_FIFO) |
Nothing (padding) | |
#define | FIFO_NORMAL REG2ID(GFX_NORMAL) |
Normal for following vertices. | |
#define | FIFO_PAL_FORMAT REG2ID(GFX_PAL_FORMAT) |
Texture palette attributes. | |
#define | FIFO_POLY_FORMAT REG2ID(GFX_POLY_FORMAT) |
Polygon attributes. | |
#define | FIFO_SHININESS REG2ID(GFX_SHININESS) |
Shininess table to be used for the following vertices. | |
#define | FIFO_SPECULAR_EMISSION REG2ID(GFX_SPECULAR_EMISSION) |
Specular and emmissive material properties for the following vertices. | |
#define | FIFO_STATUS REG2ID(GFX_STATUS) |
Geometry engine status register. | |
#define | FIFO_TEX_COORD REG2ID(GFX_TEX_COORD) |
Texture coordinate. | |
#define | FIFO_TEX_FORMAT REG2ID(GFX_TEX_FORMAT) |
Texture format. | |
#define | FIFO_VERTEX10 REG2ID(GFX_VERTEX10) |
Vertex with 3 10bit paramaters. | |
#define | FIFO_VERTEX16 REG2ID(GFX_VERTEX16) |
Vertex with 3 16bit paramaters. | |
#define | FIFO_VERTEX_XY REG2ID(GFX_VERTEX_XY) |
Vertex that uses the last Z. | |
#define | FIFO_VERTEX_XZ REG2ID(GFX_VERTEX_XZ) |
Vertex that uses the last Y. | |
#define | FIFO_VERTEX_YZ REG2ID(GFX_VERTEX_YZ) |
Vertex that uses the last X. | |
#define | FIFO_VIEWPORT REG2ID(GFX_VIEWPORT) |
Set the viewport. | |
#define | floatto12d3(n) ((fixed12d3)((n) * (1 << 3))) |
Convert float to fixed12d3. | |
#define | floattot16(n) ((t16)((n) * (1 << 4))) |
Convert float to t16. | |
#define | floattov10(n) (((n) > 0.998) ? 0x1FF : ((v10)((n) * (1 << 9)))) |
Convert float to v10. | |
#define | floattov16(n) ((v16)((n) * (1 << 12))) |
Convert float to v16. | |
#define | GL_MAX_DEPTH 0x7FFF |
The maximum value for the type fixed12d3. | |
#define | intto12d3(n) ((n) << 3) |
Convert int to fixed12d3. | |
#define | inttot16(n) ((n) << 4) |
Convert int to t16. | |
#define | inttov10(n) ((n) << 9) |
Convert int to v10. | |
#define | inttov16(n) ((n) << 12) |
Convert int to v16. | |
#define | NORMAL_PACK(x, y, z) (u32)(((x) & 0x3FF) | (((y) & 0x3FF) << 10) | ((z) << 20)) |
Pack 3 v10 normals into a 32 bit value. | |
#define | REG2ID(r) (u8)((((u32)(&(r))) - 0x04000400) >> 2) |
Converts a GFX command for use in a packed command list. | |
#define | t16toint(n) ((n) >> 4) |
Convert t16 to int. | |
#define | TEXTURE_PACK(u, v) (((u) & 0xFFFF) | ((v) << 16)) |
Pack two t16 texture coordinate values into a 32 bit value. | |
#define | v10toint(n) ((n) >> 9) |
Convert v10 to int. | |
#define | v16toint(n) ((n) >> 12) |
Convert v16 to int. | |
#define | VERTEX_PACK(x, y) (u32)(((x) & 0xFFFF) | ((y) << 16)) |
Pack two v16 values into one 32 bit value. | |
Typedefs | |
typedef uint16_t | fixed12d3 |
Depth in 12.3 fixed point. | |
typedef struct GLvector | GLvector |
Holds a vector. | |
typedef struct m3x3 | m3x3 |
Holds a 3x3 matrix. | |
typedef struct m4x3 | m4x3 |
Holds a 4x3 matrix. | |
typedef struct m4x4 | m4x4 |
Holds a 4x4 matrix. | |
typedef unsigned short | rgb |
Holds a color value (1 bit alpha, 5 bits red, 5 bits green, 5 bits blue). | |
typedef short | t16 |
Texture coordinate 12.4 in fixed point. | |
typedef short int | v10 |
Normal component in 0.10 fixed point, not used for 10 bit vertices. | |
typedef short int | v16 |
Vertex coordinate in 4.12 fixed point. | |
Functions | |
static void | glAlphaFunc (int alphaThreshold) |
Set the minimum alpha value that will be displayed. | |
int | glAssignColorTable (int target, int name) |
glAssignColorTable sets the active texture with a palette set with another texture. | |
static void | glBegin (GL_GLBEGIN_ENUM mode) |
Starts a polygon group. | |
int | glBindTexture (int target, int name) |
glBindTexure sets the current named texture to the active texture. | |
void | glCallList (const void *list) |
Sends a packed list of commands into the graphics FIFO via asyncronous DMA. | |
void | glClearColor (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) |
Sets the color of the rear-plane (a.k.a clear color/plane) | |
static void | glClearDepth (fixed12d3 depth) |
Reset the depth buffer to this value. | |
void | glClearFogEnable (bool enable) |
Defines whether fog is applied to the clear plane or not. | |
void | glClearPolyID (uint8_t ID) |
Sets the polygon ID of the rear-plane (a.k.a. clear color/plane) | |
static void | glColor (rgb color) |
Set the color for the following vertices. | |
static void | glColor3b (uint8_t red, uint8_t green, uint8_t blue) |
Set the color for the following vertices. | |
static void | glColor3f (float r, float g, float b) |
Specify a color for following vertices. | |
int | glColorSubTableEXT (int target, int start, int count, int empty1, int empty2, const void *data) |
Loads a 15-bit color format palette into a specific spot in a currently bound texture's existing palette. | |
int | glColorTableEXT (int target, int empty1, uint16_t width, int empty2, int empty3, const void *table) |
Loads a 15-bit color palette into palette memory, and sets it to the currently bound texture. | |
static void | glCutoffDepth (fixed12d3 wVal) |
Stop the drawing of polygons that are a certain distance from the camera. | |
int | glDeleteTextures (int n, int *names) |
Deletes the specified number of textures (and associated palettes). | |
static void | glDisable (int bits) |
Disables various GL states (blend, alpha test, etc..). | |
static void | glEnable (int bits) |
Enables various GL states (blend, alpha test, etc..). | |
static void | glEnd (void) |
Ends a polygon group. | |
static void | glFlush (u32 mode) |
Waits for a vertical blank (like swiWaitForVBlank) and swaps the buffers. | |
static void | glFogColor (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) |
Sets the fog color. | |
static void | glFogDensity (int index, int density) |
Sets the fog density at a given index. | |
static void | glFogOffset (int offset) |
Sets the FOG_OFFSET value. | |
static void | glFogShift (int shift) |
Sets the FOG_SHIFT value. | |
static void | glFrustum (float left, float right, float bottom, float top, float near, float far) |
Specifies the viewing frustum for the projection matrix (floating point version). | |
void | glFrustumf32 (int left, int right, int bottom, int top, int near, int far) |
Specifies the viewing frustum for the projection matrix (fixed point version). | |
int | glGenTextures (int n, int *names) |
Creates room for the specified number of textures. | |
int | glGetColorTableEXT (int target, int empty1, int empty2, void *table) |
Retrieves a 15-bit color format palette from the palette memory of the currently bound texture. | |
int | glGetColorTableParameterEXT (int target, int pname, int *params) |
glGetColorTableParameterEXT retrieves information pertaining to the currently bound texture's palette. | |
void * | glGetColorTablePointer (int name) |
Returns the address alocated to the palette of the texture named by name. | |
void | glGetFixed (const GL_GET_ENUM param, int *f) |
Gets fixed format of state variables. | |
void | glGetInt (GL_GET_ENUM param, int *i) |
Grabs integer state variables from OpenGL. | |
u32 | glGetTexParameter (void) |
Returns the active texture parameter. | |
void * | glGetTextureExtPointer (int name) |
Returns address allocated to the extra compressed texure data named by name. | |
void * | glGetTexturePointer (int name) |
Returns the address allocated to the texure named by name. | |
int | glInit (void) |
Initializes the GL state machine (must be called once before using GL calls). | |
static void | glLight (int id, rgb color, v10 x, v10 y, v10 z) |
Set up a light. | |
static void | glLoadIdentity (void) |
Loads an identity matrix to the current matrix, same as glIdentity(). | |
static void | glLoadMatrix4x3 (const m4x3 *m) |
Loads a 4x3 matrix into the current matrix. | |
static void | glLoadMatrix4x4 (const m4x4 *m) |
Loads a 4x4 matrix into the current matrix. | |
int | glLockVRAMBank (uint16_t *addr) |
Locks a designated VRAM bank to prevent consideration of the bank when allocating textures. | |
void | glMaterialf (GL_MATERIALS_ENUM mode, rgb color) |
Specify the material properties to be used in rendering lit polygons. | |
static void | glMaterialShinyness (void) |
The DS uses a table for shininess. This generates one. | |
static void | glMatrixMode (GL_MATRIX_MODE_ENUM mode) |
Change the current matrix mode. | |
static void | glMultMatrix3x3 (const m3x3 *m) |
Multiplies the current matrix by a 3x3 matrix. | |
static void | glMultMatrix4x3 (const m4x3 *m) |
Multiplies the current matrix by a 4x3 matrix. | |
static void | glMultMatrix4x4 (const m4x4 *m) |
Multiplies the current matrix by a 4x4 matrix. | |
static void | glNormal (u32 normal) |
The normal to use for the following vertices. | |
static void | glNormal3f (float x, float y, float z) |
The normal to use for following vertices. | |
static void | glOrtho (float left, float right, float bottom, float top, float zNear, float zFar) |
Multiplies the current matrix into ortho graphic mode. | |
void | glOrthof32 (int left, int right, int bottom, int top, int zNear, int zFar) |
Multiplies the current matrix into orthographic mode. | |
static void | glPolyFmt (u32 params) |
Set the parameters for polygons rendered on the current frame. | |
static void | glPopMatrix (int num) |
Pops the specified number of matrices from the stack. | |
static void | glPushMatrix (void) |
Pushes the current matrix to the stack. | |
void | glResetMatrixStack (void) |
Resets matrix stack to top level. | |
void | glResetTextures (void) |
Resets the GL texture state freeing all texture and texture palette memory. | |
static void | glRestoreMatrix (int index) |
Restores the current matrix from a location in the stack. | |
static void | glRotatef (float angle, float x, float y, float z) |
Rotate about an arbitrary axis. | |
static void | glRotatef32 (float angle, int x, int y, int z) |
Rotate on an arbitrary axis. | |
void | glRotatef32i (int angle, int32_t x, int32_t y, int32_t z) |
Rotates the model view matrix by angle about the specified unit vector. | |
static void | glRotateX (float angle) |
Rotates the current modelview matrix by angle degrees around the X axis. | |
static void | glRotateXi (int angle) |
Rotates the current modelview matrix by angle around the X axis. | |
static void | glRotateY (float angle) |
Rotates the current modelview matrix by angle degrees around the Y axis. | |
static void | glRotateYi (int angle) |
Rotates the current modelview matrix by angle around the Y axis. | |
static void | glRotateZ (float angle) |
Rotates the current modelview matrix by angle degrees around the Z axis. | |
static void | glRotateZi (int angle) |
Rotates the current modelview matrix by angle around the Z axis. | |
static void | glScalef (float x, float y, float z) |
Multiply the current matrix by a scale matrix. | |
static void | glScalef32 (int x, int y, int z) |
Multiply the current matrix by a scale matrix. | |
static void | glScalev (const GLvector *v) |
Multiply the current matrix by a scale matrix. | |
static void | glSetOutlineColor (int id, rgb color) |
Specifies an edge color for polygons. | |
static void | glSetToonTable (const uint16_t *table) |
Loads a toon table. | |
static void | glSetToonTableRange (int start, int end, rgb color) |
Sets a range of colors on the toon table. | |
static void | glStoreMatrix (int index) |
Place the current matrix into the stack at the specified location. | |
void | glTexCoord2f (float s, float t) |
Sets texture coordinates for following vertices. | |
void | glTexCoord2f32 (int32_t u, int32_t v) |
Sets texture coordinates for following vertices (fixed point version). | |
static void | glTexCoord2i (t16 u, t16 v) |
Sets texture coordinates for the following vertices. | |
static void | glTexCoord2t16 (t16 u, t16 v) |
Sets texture coordinates for the following vertices. | |
int | glTexImage2D (int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int empty2, int param, const void *texture) |
Loads a 2D texture into texture memory and sets the currently bound texture ID to the attributes specified. | |
int | glTexParameter (int target, int param) |
Set parameters for the current texture. | |
static enum GL_TEXTURE_SIZE_ENUM | glTexSizeToEnum (int size) |
This converts a size in pixels to a GL_TEXTURE_SIZE_ENUM value. | |
static void | glTranslatef (float x, float y, float z) |
Multiply the current matrix by a translation matrix. | |
static void | glTranslatef32 (int x, int y, int z) |
Multiply the current matrix by a translation matrix. | |
static void | glTranslatev (const GLvector *v) |
Multiply the current matrix by a translation matrix. | |
static void | gluLookAt (float eyex, float eyey, float eyez, float lookAtx, float lookAty, float lookAtz, float upx, float upy, float upz) |
Places the camera at the specified location and orientation (floating point version). | |
void | gluLookAtf32 (int eyex, int eyey, int eyez, int lookAtx, int lookAty, int lookAtz, int upx, int upy, int upz) |
Places the camera at the specified location and orientation (fixed point version). | |
int | glUnlockVRAMBank (uint16_t *addr) |
Unlocks a designated VRAM bank to allow consideration of the bank when allocating textures. | |
static void | gluPerspective (float fovy, float aspect, float zNear, float zFar) |
Utility function that sets up the projection matrix (floating point version) | |
void | gluPerspectivef32 (int fovy, int aspect, int zNear, int zFar) |
Utility function which sets up the projection matrix (fixed point version). | |
void | gluPickMatrix (int x, int y, int width, int height, const int viewport[4]) |
Utility function which generates a picking matrix for selection. | |
static void | glVertex2v16 (v16 x, v16 y) |
Specifies a new vertex by its X and Y components. | |
static void | glVertex3f (float x, float y, float z) |
Specifies a vertex location. | |
static void | glVertex3v16 (v16 x, v16 y, v16 z) |
Specifies a vertex. | |
static void | glViewport (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) |
Specify the viewport for following drawing. | |
static u32 | POLY_ALPHA (u32 n) |
Used in glPolyFmt() to set the alpha level for the following polygons. | |
static u32 | POLY_ID (u32 n) |
Used in glPolyFmt() to set the polygon ID for the following polygons. | |
Video API vaguely similar to OpenGL.
For more information about the 3D hardware of the NDS, check GBATEK: https://www.problemkaputt.de/gbatek.htm#ds3dvideo
typedef uint16_t fixed12d3 |
Depth in 12.3 fixed point.
Related functions: glClearDepth(), glCutoffDepth()
Holds a vector.
Related functions: glScalev(), glTranslatev()
enum DISP3DCNT_ENUM |
3D display control register bits.
Related functions: glEnable(), glDisable(), glInit()
Enumerator | |
---|---|
GL_TEXTURE_2D | Enable/disable textures on the geometry engine. |
GL_TOON_HIGHLIGHT | Enable = Highlight shading; disable = Toon shading. |
GL_ALPHA_TEST | Whether to use the alpha threshold set in glAlphaFunc() |
GL_BLEND | Enable/disable alpha blending. |
GL_ANTIALIAS | Enable/disable edge antialiasing. Antialiasing is applied to polygon edges, to make the edges look smoother. There is no antialiasing applied inside polygons or at intersections between two polygons. Antialiasing also doesn't apply to translucent pixels. Antialiasing interferes with wireframe polygons, lines, points, and edge marking. |
GL_OUTLINE | Enable/disable edge coloring; the high 3bits of the polygon ID determine the color; glSetOutlineColor() sets the available colors. |
GL_FOG_ONLY_ALPHA | If it's enabled, only the fog alpha value is used, not the color. If it's disabled, both fog color and alpha are used. |
GL_FOG | Enables/disables fog. |
GL_COLOR_UNDERFLOW | Enabled = color buffer underflow, setting it to 1 resets the overflow flag; disabled = no color buffer overflow. |
GL_POLY_OVERFLOW | Enabled = polygon/vertex buffer overflow, setting it to 1 resets the overflow flag; disabled = no polygon/vertex buffer overflow. |
GL_CLEAR_BMP | Enable: rear/clear plane is in BMP mode; disable = rear/color plane is in clear mode. |
enum GL_GET_ENUM |
Enums for reading information from the geometry engine.
Related functions: glGetInt(), glGetFixed()
Enumerator | |
---|---|
GL_GET_VERTEX_RAM_COUNT | Returns a count of vertexes currently stored in hardware vertex ram. Use glGetInt() |
GL_GET_POLYGON_RAM_COUNT | Returns a count of polygons currently stored in hardware polygon ram. Use glGetInt() |
GL_GET_MATRIX_VECTOR | Returns the current 3x3 directional vector matrix. Use glGetFixed() |
GL_GET_MATRIX_POSITION | Returns the current 4x4 position matrix. Use glGetFixed() |
GL_GET_MATRIX_PROJECTION | Returns the current 4x4 projection matrix. Use glGetFixed() |
GL_GET_MATRIX_CLIP | Returns the current 4x4 clip matrix. Use glGetFixed() |
GL_GET_TEXTURE_WIDTH | Returns the width of the currently bound texture. Use glGetInt() |
GL_GET_TEXTURE_HEIGHT | Returns the height of the currently bound texture. Use glGetInt() |
enum GL_GLBEGIN_ENUM |
Polygon drawing modes.
Related functions: glBegin()
enum GL_MATERIALS_ENUM |
Material types.
Related functions: glMaterialf()
enum GL_MATRIX_MODE_ENUM |
Matrix modes.
Related functions: glMatrixMode()
Enumerator | |
---|---|
GL_PROJECTION | Projection matrix. |
GL_POSITION | Position matrix. |
GL_MODELVIEW | Modelview matrix. |
GL_TEXTURE | Texture matrix. |
enum GL_POLY_FORMAT_ENUM |
Polygon rendering attributes.
Related functions: glPolyFmt(), glInit(), POLY_ALPHA(), POLY_ID()
Enums for texture palette data retrieval.
Related functions: glGetColorTableParameterEXT()
Enumerator | |
---|---|
GL_COLOR_TABLE_FORMAT_EXT | Retrieve the palette address in memory. |
GL_COLOR_TABLE_WIDTH_EXT | Retrieve the size of the palette. |
Texture parameters such as texture wrapping and texture coord wrapping.
Related functions: glTexImage2D(), glTexParameter()
enum GL_TEXTURE_SIZE_ENUM |
Possibles size of a texture (horizontal and vertical).
Related functions: glTexImage2D(), glTexParameter()
enum GL_TEXTURE_TYPE_ENUM |
Texture formats.
Related functions: glTexImage2D(), glTexParameter()
Enumerator | |
---|---|
GL_NOTEXTURE | No texture is used - useful for making palettes. |
GL_RGB32_A3 | 32 color palette, 3 bits of alpha |
GL_RGB4 | 4 color palette |
GL_RGB16 | 16 color palette |
GL_RGB256 | 256 color palette |
GL_COMPRESSED | Compressed texture. |
GL_RGB8_A5 | 8 color palette, 5 bits of alpha |
GL_RGBA | 15 bit direct color, 1 bit of alpha |
GL_RGB | 15 bit direct color. Converted to GL_RGBA internally, which causes a performance penalty when using glTexImage2D(). This format isn't recommended, use GL_RGBA instead. |
enum GLFLUSH_ENUM |
Arguments for glFlush().
Related functions: glEnable(), glDisable(), glInit()
Enumerator | |
---|---|
GL_TRANS_MANUALSORT | Enable manual sorting of translucent polygons, otherwise uses Y-sorting. |
GL_WBUFFERING | Enable W depth buffering of vertices, otherwise uses Z depth buffering. |
|
inlinestatic |
Set the minimum alpha value that will be displayed.
Polygons with a lower alpha value won't be displayed.
alphaThreshold | Minimum alpha value that will be used (0 - 15). |
int glAssignColorTable | ( | int | target, |
int | name | ||
) |
glAssignColorTable sets the active texture with a palette set with another texture.
If the other texture doesn't have a palette, the function will fail but the palette of the active texture will be deleted anyway, and no new palette will be assigned.
target | Ignored, only here for OpenGL compatibility. |
name | The name(int value) of the texture to load a palette from. |
|
inlinestatic |
Starts a polygon group.
mode | The draw mode for the polygon. |
int glBindTexture | ( | int | target, |
int | name | ||
) |
glBindTexure sets the current named texture to the active texture.
The target is ignored as all DS textures are 2D.
target | Ignored, only here for OpenGL compatibility. |
name | The name (int value) to set to the current texture. |
void glCallList | ( | const void * | list | ) |
Sends a packed list of commands into the graphics FIFO via asyncronous DMA.
The first 32 bits is the length of the packed command list, followed by the packed list.
list | Pointer to the packed list. |
void glClearColor | ( | uint8_t | red, |
uint8_t | green, | ||
uint8_t | blue, | ||
uint8_t | alpha | ||
) |
Sets the color of the rear-plane (a.k.a clear color/plane)
red | Red component (0 - 31). |
green | Green component (0 - 31). |
blue | Blue component (0 - 31). |
alpha | Alpha from 0 (clear) to 31 (opaque). |
|
inlinestatic |
Reset the depth buffer to this value.
Generally set this to GL_MAX_DEPTH.
depth | Distance from the camera. Generally set to GL_MAX_DEPTH. |
void glClearFogEnable | ( | bool | enable | ) |
Defines whether fog is applied to the clear plane or not.
enable | True to apply fog to the clear plane, false to not apply it. |
void glClearPolyID | ( | uint8_t | ID | ) |
Sets the polygon ID of the rear-plane (a.k.a. clear color/plane)
Useful for antialiasing and edge coloring.
ID | The polygon ID to give the rear-plane. |
|
inlinestatic |
Set the color for the following vertices.
color | The 15 bit color value. |
|
inlinestatic |
Set the color for the following vertices.
red | The red component (0 - 255). Bottom 3 bits ignored. |
green | The green component (0 - 255). Bottom 3 bits ignored. |
blue | The blue component (0 - 255). Bottom 3 bits ignored. |
|
inlinestatic |
Specify a color for following vertices.
r | The red component of the color. |
g | The green component of the color. |
b | The blue component of the color. |
int glColorSubTableEXT | ( | int | target, |
int | start, | ||
int | count, | ||
int | empty1, | ||
int | empty2, | ||
const void * | data | ||
) |
Loads a 15-bit color format palette into a specific spot in a currently bound texture's existing palette.
target | Ignored, only here for OpenGL compatibility. |
start | The starting index that new palette data will be written to. |
count | The number of entries to write. |
empty1 | Ignored, only here for OpenGL compatibility. |
empty2 | Ignored, only here for OpenGL compatibility. |
data | Pointer to the palette data to load. |
int glColorTableEXT | ( | int | target, |
int | empty1, | ||
uint16_t | width, | ||
int | empty2, | ||
int | empty3, | ||
const void * | table | ||
) |
Loads a 15-bit color palette into palette memory, and sets it to the currently bound texture.
It can also remove palettes.
target | Ignored, only here for OpenGL compatibility. |
empty1 | Ignored, only here for OpenGL compatibility. |
width | The length of the palette in colors (if 0, the palette is removed from currently bound texture). |
empty2 | Ignored, only here for OpenGL compatibility. |
empty3 | Ignored, only here for OpenGL compatibility. |
table | Pointer to the palette data to load (if NULL, the palette is removed from currently bound texture). |
|
inlinestatic |
Stop the drawing of polygons that are a certain distance from the camera.
Polygons that are beyond this W-value (distance from camera) will not be drawn.
wVal | Distance (15 bit value). |
int glDeleteTextures | ( | int | n, |
int * | names | ||
) |
Deletes the specified number of textures (and associated palettes).
n | The number of textures to delete. |
names | Pointer to the names array to empty. |
|
inlinestatic |
Disables various GL states (blend, alpha test, etc..).
bits | Bit mask of desired attributes, enumerated in DISP3DCNT_ENUM. |
|
inlinestatic |
Enables various GL states (blend, alpha test, etc..).
bits | Bit mask of desired attributes, enumerated in DISP3DCNT_ENUM. |
|
inlinestatic |
Waits for a vertical blank (like swiWaitForVBlank) and swaps the buffers.
It lets you specify some 3D options: enabling Y-sorting of translucent polygons and W-Buffering of all vertices.
mode | Flags from GLFLUSH_ENUM. |
|
inlinestatic |
Sets the fog color.
red | Red component (0 - 31). |
green | Green component (0 - 31). |
blue | Blue component (0 - 31). |
alpha | From 0 (clear) to 31 (opaque). |
|
inlinestatic |
Sets the fog density at a given index.
index | Fog table index to operate on (0 to 31). |
density | Fog density from 0 (none) to 127 (opaque). |
|
inlinestatic |
Sets the FOG_OFFSET value.
Fog begins at this depth with a density of FOG_TABLE[0].
offset | FOG_OFFSET value. |
|
inlinestatic |
Sets the FOG_SHIFT value.
Each entry of the fog table covers 0x400 >> FOG_SHIFT depth values.
shift | FOG_SHIFT value. |
|
inlinestatic |
Specifies the viewing frustum for the projection matrix (floating point version).
left | Left of a rectangle located at the near clipping plane. |
right | Right of a rectangle located at the near clipping plane. |
top | Top of a rectangle located at the near clipping plane. |
bottom | Bottom of a rectangle located at the near clipping plane. |
near | Location of a the near clipping plane (parallel to viewing window). |
far | Location of a the far clipping plane (parallel to viewing window). |
void glFrustumf32 | ( | int | left, |
int | right, | ||
int | bottom, | ||
int | top, | ||
int | near, | ||
int | far | ||
) |
Specifies the viewing frustum for the projection matrix (fixed point version).
left | Left of a rectangle located at the near clipping plane. |
right | Right of a rectangle located at the near clipping plane. |
top | Top of a rectangle located at the near clipping plane. |
bottom | Bottom of a rectangle located at the near clipping plane. |
near | Location of a the near clipping plane (parallel to viewing window). |
far | Location of a the far clipping plane (parallel to viewing window). |
int glGenTextures | ( | int | n, |
int * | names | ||
) |
Creates room for the specified number of textures.
n | The number of textures to generate. |
names | Pointer to the names array to fill. |
int glGetColorTableEXT | ( | int | target, |
int | empty1, | ||
int | empty2, | ||
void * | table | ||
) |
Retrieves a 15-bit color format palette from the palette memory of the currently bound texture.
target | Ignored, only here for OpenGL compatibility. |
empty1 | Ignored, only here for OpenGL compatibility. |
empty2 | Ignored, only here for OpenGL compatibility. |
table | Pointer where palette data will be written to. |
int glGetColorTableParameterEXT | ( | int | target, |
int | pname, | ||
int * | params | ||
) |
glGetColorTableParameterEXT retrieves information pertaining to the currently bound texture's palette.
target | Ignored, only here for OpenGL compatibility. |
pname | A parameter of type GL_TEXTURE_PALETTE_PARAM_ENUM, used to read a specific attribute into params |
params | The destination for the attribute to read into. |
void * glGetColorTablePointer | ( | int | name | ) |
Returns the address alocated to the palette of the texture named by name.
name | The name of the texture to get a pointer to. |
void glGetFixed | ( | const GL_GET_ENUM | param, |
int * | f | ||
) |
Gets fixed format of state variables.
OpenGL's modelview matrix is handled on the DS with two matrices. The combination of the DS's position matrix and directional vector matrix holds the data that is in OpenGL's one modelview matrix. (a.k.a. modelview = postion and vector).
param | The state variable to retrieve. |
f | Pointer with room to hold the requested data. |
void glGetInt | ( | GL_GET_ENUM | param, |
int * | i | ||
) |
Grabs integer state variables from OpenGL.
param | The state variable to retrieve |
i | Pointer with room to hold the requested data |
u32 glGetTexParameter | ( | void | ) |
Returns the active texture parameter.
void * glGetTextureExtPointer | ( | int | name | ) |
Returns address allocated to the extra compressed texure data named by name.
name | The name of the texture to get a pointer to. |
void * glGetTexturePointer | ( | int | name | ) |
Returns the address allocated to the texure named by name.
name | The name of the texture to get a pointer to. |
int glInit | ( | void | ) |
Initializes the GL state machine (must be called once before using GL calls).
Set up a light.
Only parallel light sources are supported on the DS. Also, the direction must be normalized.
id | The number of the light to setup. |
color | The color of the light. |
x | X component of the lights directional vector. |
y | Y component of the lights directional vector. |
z | Z component of the lights directional vector. |
|
inlinestatic |
Loads a 4x3 matrix into the current matrix.
m | Pointer to a 4x3 matrix. |
|
inlinestatic |
Loads a 4x4 matrix into the current matrix.
m | Pointer to a 4x4 matrix. |
int glLockVRAMBank | ( | uint16_t * | addr | ) |
Locks a designated VRAM bank to prevent consideration of the bank when allocating textures.
addr | The base address of the VRAM bank. |
void glMaterialf | ( | GL_MATERIALS_ENUM | mode, |
rgb | color | ||
) |
Specify the material properties to be used in rendering lit polygons.
mode | Which material property to change. |
color | The color to set for that material property. |
|
inlinestatic |
Change the current matrix mode.
mode | New mode for the matrix. |
|
inlinestatic |
Multiplies the current matrix by a 3x3 matrix.
m | Pointer to a 3x3 matrix. |
|
inlinestatic |
Multiplies the current matrix by a 4x3 matrix.
m | Pointer to a 4x3 matrix. |
|
inlinestatic |
Multiplies the current matrix by a 4x4 matrix.
m | Pointer to a 4x4 matrix. |
|
inlinestatic |
The normal to use for the following vertices.
normal | The packed normal (three 10 bit values: x, y, z). |
|
inlinestatic |
The normal to use for following vertices.
x | X component of the normal, vector must be normalized. |
y | Y component of the normal, vector must be normalized. |
z | Z component of the normal, vector must be normalized. |
|
inlinestatic |
Multiplies the current matrix into ortho graphic mode.
left | Left vertical clipping plane. |
right | Right vertical clipping plane. |
bottom | Bottom vertical clipping plane. |
top | Top vertical clipping plane. |
zNear | Near clipping plane. |
zFar | Far clipping plane. |
void glOrthof32 | ( | int | left, |
int | right, | ||
int | bottom, | ||
int | top, | ||
int | zNear, | ||
int | zFar | ||
) |
Multiplies the current matrix into orthographic mode.
left | Left vertical clipping plane. |
right | Right vertical clipping plane. |
bottom | Bottom vertical clipping plane. |
top | Top vertical clipping plane. |
zNear | Near clipping plane. |
zFar | Far clipping plane. |
|
inlinestatic |
Set the parameters for polygons rendered on the current frame.
Valid paramters are enumerated in GL_POLY_FORMAT_ENUM and in the functions POLY_ALPHA() and POLY_ID().
params | The paramters to set for the following polygons. |
|
inlinestatic |
Pops the specified number of matrices from the stack.
num | The number of matrices to pop. |
|
inlinestatic |
Restores the current matrix from a location in the stack.
index | The location in the stack. |
|
inlinestatic |
Rotate about an arbitrary axis.
x | The x component of the axis to rotate on. |
y | The y component of the axis to rotate on. |
z | The z component of the axis to rotate on. |
angle | The angle to rotate by. |
|
inlinestatic |
Rotate on an arbitrary axis.
angle | The angle to rotate by |
x | The x component of the axis to rotate on. |
y | The y component of the axis to rotate on. |
z | The z component of the axis to rotate on. |
void glRotatef32i | ( | int | angle, |
int32_t | x, | ||
int32_t | y, | ||
int32_t | z | ||
) |
Rotates the model view matrix by angle about the specified unit vector.
angle | The angle to rotate by |
x | X component of the unit vector axis. |
y | Y component of the unit vector axis. |
z | Z component of the unit vector axis. |
|
inlinestatic |
Rotates the current modelview matrix by angle degrees around the X axis.
angle | The angle to rotate by. |
|
inlinestatic |
Rotates the current modelview matrix by angle around the X axis.
angle | The angle to rotate by (angle is -32768 to 32767). |
|
inlinestatic |
Rotates the current modelview matrix by angle degrees around the Y axis.
angle | The angle to rotate by. |
|
inlinestatic |
Rotates the current modelview matrix by angle around the Y axis.
angle | The angle to rotate by (angle is -32768 to 32767). |
|
inlinestatic |
Rotates the current modelview matrix by angle degrees around the Z axis.
angle | The angle to rotate by. |
|
inlinestatic |
Rotates the current modelview matrix by angle around the Z axis.
angle | The angle to rotate by (angle is -32768 to 32767). |
|
inlinestatic |
Multiply the current matrix by a scale matrix.
x | Scaling on the x axis. |
y | Scaling on the y axis. |
z | Scaling on the z axis. |
|
inlinestatic |
Multiply the current matrix by a scale matrix.
x | Scaling on the x axis. |
y | Scaling on the y axis. |
z | Scaling on the z axis. |
|
inlinestatic |
Multiply the current matrix by a scale matrix.
v | The vector to scale by. |
|
inlinestatic |
Specifies an edge color for polygons.
id | Which outline color to set (0 - 7). |
color | The 15 bit color to set |
|
inlinestatic |
Loads a toon table.
table | Pointer to the 32 color palette to load into the toon table. |
|
inlinestatic |
Sets a range of colors on the toon table.
start | The start of the range |
end | The end of the range |
color | The color to set for that range */ |
|
inlinestatic |
Place the current matrix into the stack at the specified location.
index | The location in the stack. |
void glTexCoord2f | ( | float | s, |
float | t | ||
) |
Sets texture coordinates for following vertices.
s | S (a.k.a. U) texture coordinate (0.0 - 1.0). |
t | T (a.k.a. V) texture coordinate (0.0 - 1.0). |
void glTexCoord2f32 | ( | int32_t | u, |
int32_t | v | ||
) |
Sets texture coordinates for following vertices (fixed point version).
u | U (a.k.a. S) texture coordinate (0.0 - 1.0). |
v | V (a.k.a. T) texture coordinate (0.0 - 1.0). |
Sets texture coordinates for the following vertices.
u | U (a.k.a. S) texture coordinate in texels (12.0 format). |
v | V (a.k.a. T) texture coordinate in texels (12.0 format). |
Sets texture coordinates for the following vertices.
u | U (a.k.a. S) texture coordinate in texels (12.4 format). |
v | V (a.k.a. T) texture coordinate in texels (12.4 format). |
int glTexImage2D | ( | int | target, |
int | empty1, | ||
GL_TEXTURE_TYPE_ENUM | type, | ||
int | sizeX, | ||
int | sizeY, | ||
int | empty2, | ||
int | param, | ||
const void * | texture | ||
) |
Loads a 2D texture into texture memory and sets the currently bound texture ID to the attributes specified.
The only allowed texture sizes are powers of two between 8 and 1024 (inclusive). It is possible to specify the size in pixels or using the values of GL_TEXTURE_SIZE_ENUM. Note that a value of 0 won't cause an error because is a GL_TEXTURE_SIZE_ENUM value equivalent to 8 pixels.
target | Ignored, only here for OpenGL compatibility. |
empty1 | Ignored, only here for OpenGL compatibility. |
type | The format of the texture. |
sizeX | Width of the texture (in pixels or GL_TEXTURE_SIZE_ENUM values). |
sizeY | Height of the texture (in pixels or GL_TEXTURE_SIZE_ENUM values). |
empty2 | Ignored, only here for OpenGL compatibility. |
param | Parameters of the texture. |
texture | Pointer to the texture data to load. If this is NULL, the texture will be allocated but no data will be copied to it. |
int glTexParameter | ( | int | target, |
int | param | ||
) |
Set parameters for the current texture.
Although it's named the same as its OpenGL counterpart, it is not compatible.
target | Ignored, only here for OpenGL compatibility. |
param | Paramaters for the texture. |
|
inlinestatic |
This converts a size in pixels to a GL_TEXTURE_SIZE_ENUM value.
Note: This is not a real OpenGL function.
size | Size in pixels. |
|
inlinestatic |
Multiply the current matrix by a translation matrix.
x | Translation on the x axis. |
y | Translation on the y axis. |
z | Translation on the z axis. |
|
inlinestatic |
Multiply the current matrix by a translation matrix.
x | Translation on the x axis. |
y | Translation on the y axis. |
z | Translation on the z axis. |
|
inlinestatic |
Multiply the current matrix by a translation matrix.
v | The vector to translate by. |
|
inlinestatic |
Places the camera at the specified location and orientation (floating point version).
eyex | (eyex, eyey, eyez) Location of the camera. |
eyey | (eyex, eyey, eyez) Location of the camera. |
eyez | (eyex, eyey, eyez) Location of the camera. |
lookAtx | (lookAtx, lookAty, lookAtz) Where the camera is looking. |
lookAty | (lookAtx, lookAty, lookAtz) Where the camera is looking. |
lookAtz | (lookAtx, lookAty, lookAtz) Where the camera is looking. |
upx | Unit vector describing which direction is up for the camera. |
upy | Unit vector describing which direction is up for the camera. |
upz | Unit vector describing which direction is up for the camera. |
void gluLookAtf32 | ( | int | eyex, |
int | eyey, | ||
int | eyez, | ||
int | lookAtx, | ||
int | lookAty, | ||
int | lookAtz, | ||
int | upx, | ||
int | upy, | ||
int | upz | ||
) |
Places the camera at the specified location and orientation (fixed point version).
eyex | (eyex, eyey, eyez) Location of the camera. |
eyey | (eyex, eyey, eyez) Location of the camera. |
eyez | (eyex, eyey, eyez) Location of the camera. |
lookAtx | (lookAtx, lookAty, lookAtz) Where the camera is looking. |
lookAty | (lookAtx, lookAty, lookAtz) Where the camera is looking. |
lookAtz | (lookAtx, lookAty, lookAtz) Where the camera is looking. |
upx | Unit vector describing which direction is up for the camera. |
upy | Unit vector describing which direction is up for the camera. |
upz | Unit vector describing which direction is up for the camera. |
int glUnlockVRAMBank | ( | uint16_t * | addr | ) |
Unlocks a designated VRAM bank to allow consideration of the bank when allocating textures.
addr | The base address of the VRAM bank. |
|
inlinestatic |
Utility function that sets up the projection matrix (floating point version)
fovy | Specifies the field of view in degrees. |
aspect | Specifies the aspect ratio of the screen (normally screen width/screen height). |
zNear | Specifies the near clipping plane. |
zFar | Specifies the far clipping plane. |
void gluPerspectivef32 | ( | int | fovy, |
int | aspect, | ||
int | zNear, | ||
int | zFar | ||
) |
Utility function which sets up the projection matrix (fixed point version).
fovy | Specifies the field of view in degrees (-32768 to 32767). |
aspect | Specifies the aspect ratio of the screen (normally screen width divided by screen height). |
zNear | Specifies the near clipping plane. |
zFar | Specifies the far clipping plane. |
void gluPickMatrix | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
const int | viewport[4] | ||
) |
Utility function which generates a picking matrix for selection.
x | 2D x of center (touch x normally). |
y | 2D y of center (touch y normally). |
width | Width in pixels of the window (3 or 4 is a good number). |
height | Height in pixels of the window (3 or 4 is a good number). |
viewport | The current viewport (normally {0, 0, 255, 191}). |
Specifies a new vertex by its X and Y components.
The Z component is the same as the last vertex sent to the GPU.
x | The x component for the vertex. |
y | The y component for the vertex. |
|
inlinestatic |
Specifies a vertex location.
x | The x component of the vertex. |
y | The y component of the vertex. |
z | The z component of the vertex. |
Specifies a vertex.
x | The x component for the vertex. |
y | The y component for the vertex. |
z | The z component for the vertex. |
|
inlinestatic |
Specify the viewport for following drawing.
It can be set several times per frame.
x1 | The left of the viewport. |
y1 | The bottom of the viewport. |
x2 | The right of the viewport. |
y2 | The top of the viewport. |
Used in glPolyFmt() to set the alpha level for the following polygons.
Set to 0 for wireframe mode.
n | The level of alpha (0 - 31). |
Used in glPolyFmt() to set the polygon ID for the following polygons.
n | The ID to set for following polygons (0 - 63). |