libnds
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
videoGL.h File Reference

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.
 

Enumerations

enum  DISP3DCNT_ENUM {
  GL_TEXTURE_2D = (1 << 0) ,
  GL_TOON_HIGHLIGHT = (1 << 1) ,
  GL_ALPHA_TEST = (1 << 2) ,
  GL_BLEND = (1 << 3) ,
  GL_ANTIALIAS = (1 << 4) ,
  GL_OUTLINE = (1 << 5) ,
  GL_FOG_ONLY_ALPHA = (1 << 6) ,
  GL_FOG = (1 << 7) ,
  GL_COLOR_UNDERFLOW = (1 << 12) ,
  GL_POLY_OVERFLOW = (1 << 13) ,
  GL_CLEAR_BMP = (1 << 14)
}
 3D display control register bits. More...
 
enum  GL_GET_ENUM {
  GL_GET_VERTEX_RAM_COUNT ,
  GL_GET_POLYGON_RAM_COUNT ,
  GL_GET_MATRIX_VECTOR ,
  GL_GET_MATRIX_POSITION ,
  GL_GET_MATRIX_PROJECTION ,
  GL_GET_MATRIX_CLIP ,
  GL_GET_TEXTURE_WIDTH ,
  GL_GET_TEXTURE_HEIGHT
}
 Enums for reading information from the geometry engine. More...
 
enum  GL_GLBEGIN_ENUM {
  GL_TRIANGLES = 0 ,
  GL_QUADS = 1 ,
  GL_TRIANGLE_STRIP = 2 ,
  GL_QUAD_STRIP = 3 ,
  GL_TRIANGLE = 0 ,
  GL_QUAD = 1
}
 Polygon drawing modes. More...
 
enum  GL_MATERIALS_ENUM {
  GL_AMBIENT = 0x01 ,
  GL_DIFFUSE = 0x02 ,
  GL_AMBIENT_AND_DIFFUSE = 0x03 ,
  GL_SPECULAR = 0x04 ,
  GL_SHININESS = 0x08 ,
  GL_EMISSION = 0x10
}
 Material types. More...
 
enum  GL_MATRIX_MODE_ENUM {
  GL_PROJECTION = 0 ,
  GL_POSITION = 1 ,
  GL_MODELVIEW = 2 ,
  GL_TEXTURE = 3
}
 Matrix modes. More...
 
enum  GL_POLY_FORMAT_ENUM {
  POLY_FORMAT_LIGHT0 = (1 << 0) ,
  POLY_FORMAT_LIGHT1 = (1 << 1) ,
  POLY_FORMAT_LIGHT2 = (1 << 2) ,
  POLY_FORMAT_LIGHT3 = (1 << 3) ,
  POLY_MODULATION = (0 << 4) ,
  POLY_DECAL = (1 << 4) ,
  POLY_TOON_HIGHLIGHT = (2 << 4) ,
  POLY_SHADOW = (3 << 4) ,
  POLY_CULL_FRONT = (1 << 6) ,
  POLY_CULL_BACK = (2 << 6) ,
  POLY_CULL_NONE = (3 << 6) ,
  POLY_TRANS_KEEP_DEPTH = (0 << 11) ,
  POLY_TRANS_SET_DEPTH = (1 << 11) ,
  POLY_HIDE_FAR_POLYS = (0 << 12) ,
  POLY_RENDER_FAR_POLYS = (1 << 12) ,
  POLY_HIDE_1DOT_POLYS = (0 << 13) ,
  POLY_RENDER_1DOT_POLYS = (1 << 13) ,
  POLY_DEPTH_TEST_LESS = (0 << 14) ,
  POLY_DEPTH_TEST_EQUAL = (1 << 14) ,
  POLY_FOG = (1 << 15)
}
 Polygon rendering attributes. More...
 
enum  GL_TEXTURE_PALETTE_PARAM_ENUM {
  GL_COLOR_TABLE_FORMAT_EXT = 0 ,
  GL_COLOR_TABLE_WIDTH_EXT = 1
}
 Enums for texture palette data retrieval. More...
 
enum  GL_TEXTURE_PARAM_ENUM {
  GL_TEXTURE_WRAP_S = (1 << 16) ,
  GL_TEXTURE_WRAP_T = (1 << 17) ,
  GL_TEXTURE_FLIP_S = (1 << 18) ,
  GL_TEXTURE_FLIP_T = (1 << 19) ,
  GL_TEXTURE_COLOR0_TRANSPARENT = (1 << 29) ,
  TEXGEN_OFF = (0 << 30) ,
  TEXGEN_TEXCOORD = (1 << 30) ,
  TEXGEN_NORMAL = (int)(2U << 30) ,
  TEXGEN_POSITION = (int)(3U << 30)
}
 Texture parameters such as texture wrapping and texture coord wrapping. More...
 
enum  GL_TEXTURE_SIZE_ENUM {
  TEXTURE_SIZE_INVALID = -1 ,
  TEXTURE_SIZE_8 = 0 ,
  TEXTURE_SIZE_16 = 1 ,
  TEXTURE_SIZE_32 = 2 ,
  TEXTURE_SIZE_64 = 3 ,
  TEXTURE_SIZE_128 = 4 ,
  TEXTURE_SIZE_256 = 5 ,
  TEXTURE_SIZE_512 = 6 ,
  TEXTURE_SIZE_1024 = 7
}
 Possibles size of a texture (horizontal and vertical). More...
 
enum  GL_TEXTURE_TYPE_ENUM {
  GL_NOTEXTURE = 0 ,
  GL_RGB32_A3 = 1 ,
  GL_RGB4 = 2 ,
  GL_RGB16 = 3 ,
  GL_RGB256 = 4 ,
  GL_COMPRESSED = 5 ,
  GL_RGB8_A5 = 6 ,
  GL_RGBA = 7 ,
  GL_RGB = 8
}
 Texture formats. More...
 
enum  GLFLUSH_ENUM {
  GL_TRANS_MANUALSORT = (1 << 0) ,
  GL_WBUFFERING = (1 << 1)
}
 Arguments for glFlush(). More...
 

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.
 

Detailed Description

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 Documentation

◆ fixed12d3

typedef uint16_t fixed12d3

Depth in 12.3 fixed point.

Related functions: glClearDepth(), glCutoffDepth()

◆ GLvector

typedef struct GLvector GLvector

Holds a vector.

Related functions: glScalev(), glTranslatev()

Enumeration Type Documentation

◆ 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.

◆ 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()

◆ GL_GLBEGIN_ENUM

Polygon drawing modes.

Related functions: glBegin()

Enumerator
GL_TRIANGLES 

Draw triangles with each 3 vertices defining a triangle.

GL_QUADS 

Draw quads with each 4 vertices defining a quad.

GL_TRIANGLE_STRIP 

Draw triangles with the first triangle defined by 3 vertices and each additional triangle being defined by one additional vertex.

GL_QUAD_STRIP 

Draw quads with the first quad being defined by 4 vertices and each additional triangle being defined by 2 vertices.

GL_TRIANGLE 

Same as GL_TRIANGLES, old non-OpenGL version.

GL_QUAD 

Same as GL_QUADS, old non-OpenGL version.

◆ GL_MATERIALS_ENUM

Material types.

Related functions: glMaterialf()

Enumerator
GL_AMBIENT 

Ambient color for the material (color when the normal is not facing the light).

GL_DIFFUSE 

Diffuse color for the material (color when the normal is facing the light).

GL_AMBIENT_AND_DIFFUSE 

Ambient and diffuse colors for the material at the same time.

GL_SPECULAR 

Specular color for the material. The glossy (highlight) color of the polygon.

GL_SHININESS 

Shininess color for the material. The color that shines back to the user.

GL_EMISSION 

Emission color for the material. Color independent of normals and lights.

◆ 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.

◆ GL_POLY_FORMAT_ENUM

Polygon rendering attributes.

Related functions: glPolyFmt(), glInit(), POLY_ALPHA(), POLY_ID()

Enumerator
POLY_FORMAT_LIGHT0 

Enable light number 0.

POLY_FORMAT_LIGHT1 

Enable light number 1.

POLY_FORMAT_LIGHT2 

Enable light number 2.

POLY_FORMAT_LIGHT3 

Enable light number 3.

POLY_MODULATION 

Enable modulation shading mode (default)

POLY_DECAL 

Enable decal shading.

POLY_TOON_HIGHLIGHT 

Enable toon/highlight shading mode.

POLY_SHADOW 

Enable shadow shading.

POLY_CULL_FRONT 

Cull front polygons.

POLY_CULL_BACK 

Cull rear polygons.

POLY_CULL_NONE 

Don't cull any polygons.

POLY_TRANS_KEEP_DEPTH 

Don't update depth buffer when drawing translucent polygons.

POLY_TRANS_SET_DEPTH 

Update depth buffer when drawing translucent polygons.

POLY_HIDE_FAR_POLYS 

Hide polygons that intersect with far plane.

POLY_RENDER_FAR_POLYS 

Render polygons that intersect with far plane.

POLY_HIDE_1DOT_POLYS 

Hide 1-dot polygons behind GFX_CUTOFF_DEPTH.

POLY_RENDER_1DOT_POLYS 

Draw 1-dot polygons behind GFX_CUTOFF_DEPTH.

POLY_DEPTH_TEST_LESS 

Draw polygons with a lower depth than the depth buffer.

POLY_DEPTH_TEST_EQUAL 

Draw polygons with the same depth of the depth buffer.

POLY_FOG 

Enable fog for this polygon.

◆ GL_TEXTURE_PALETTE_PARAM_ENUM

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.

◆ GL_TEXTURE_PARAM_ENUM

Texture parameters such as texture wrapping and texture coord wrapping.

Related functions: glTexImage2D(), glTexParameter()

Enumerator
GL_TEXTURE_WRAP_S 

Wrap (repeat) texture on S axis.

GL_TEXTURE_WRAP_T 

Wrap (repeat) texture on T axis.

GL_TEXTURE_FLIP_S 

Flip texture on S axis when wrapping.

GL_TEXTURE_FLIP_T 

Flip texture on T axis when wrapping.

GL_TEXTURE_COLOR0_TRANSPARENT 

Interpret color 0 as clear (same as old GL_TEXTURE_ALPHA_MASK).

TEXGEN_OFF 

Use unmodified texture coordinates.

TEXGEN_TEXCOORD 

Multiply texture coordinates by the texture matrix.

TEXGEN_NORMAL 

Set texture coordinates equal to normal * texture matrix, used for spherical reflection mapping.

TEXGEN_POSITION 

Set texture coordinates equal to vertex * texture matrix.

◆ GL_TEXTURE_SIZE_ENUM

Possibles size of a texture (horizontal and vertical).

Related functions: glTexImage2D(), glTexParameter()

Enumerator
TEXTURE_SIZE_INVALID 

An invalid number of texels.

TEXTURE_SIZE_8 

8 texels

TEXTURE_SIZE_16 

16 texels

TEXTURE_SIZE_32 

32 texels

TEXTURE_SIZE_64 

64 texels

TEXTURE_SIZE_128 

128 texels

TEXTURE_SIZE_256 

256 texels

TEXTURE_SIZE_512 

512 texels

TEXTURE_SIZE_1024 

1024 texels

◆ 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.

◆ 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.

Function Documentation

◆ glAlphaFunc()

static void glAlphaFunc ( int  alphaThreshold)
inlinestatic

Set the minimum alpha value that will be displayed.

Polygons with a lower alpha value won't be displayed.

Parameters
alphaThresholdMinimum alpha value that will be used (0 - 15).

◆ glAssignColorTable()

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.

Parameters
targetIgnored, only here for OpenGL compatibility.
nameThe name(int value) of the texture to load a palette from.
Returns
1 on success, 0 on failure.

◆ glBegin()

static void glBegin ( GL_GLBEGIN_ENUM  mode)
inlinestatic

Starts a polygon group.

Parameters
modeThe draw mode for the polygon.

◆ glBindTexture()

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.

Parameters
targetIgnored, only here for OpenGL compatibility.
nameThe name (int value) to set to the current texture.
Returns
1 on success, 0 on failure.

◆ glCallList()

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.

Parameters
listPointer to the packed list.

◆ glClearColor()

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)

Parameters
redRed component (0 - 31).
greenGreen component (0 - 31).
blueBlue component (0 - 31).
alphaAlpha from 0 (clear) to 31 (opaque).

◆ glClearDepth()

static void glClearDepth ( fixed12d3  depth)
inlinestatic

Reset the depth buffer to this value.

Generally set this to GL_MAX_DEPTH.

Parameters
depthDistance from the camera. Generally set to GL_MAX_DEPTH.

◆ glClearFogEnable()

void glClearFogEnable ( bool  enable)

Defines whether fog is applied to the clear plane or not.

Parameters
enableTrue to apply fog to the clear plane, false to not apply it.

◆ glClearPolyID()

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.

Parameters
IDThe polygon ID to give the rear-plane.

◆ glColor()

static void glColor ( rgb  color)
inlinestatic

Set the color for the following vertices.

Parameters
colorThe 15 bit color value.

◆ glColor3b()

static void glColor3b ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)
inlinestatic

Set the color for the following vertices.

Parameters
redThe red component (0 - 255). Bottom 3 bits ignored.
greenThe green component (0 - 255). Bottom 3 bits ignored.
blueThe blue component (0 - 255). Bottom 3 bits ignored.

◆ glColor3f()

static void glColor3f ( float  r,
float  g,
float  b 
)
inlinestatic

Specify a color for following vertices.

Parameters
rThe red component of the color.
gThe green component of the color.
bThe blue component of the color.
Warning
Float version! Please, use glColor3b() instead.

◆ glColorSubTableEXT()

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.

Parameters
targetIgnored, only here for OpenGL compatibility.
startThe starting index that new palette data will be written to.
countThe number of entries to write.
empty1Ignored, only here for OpenGL compatibility.
empty2Ignored, only here for OpenGL compatibility.
dataPointer to the palette data to load.
Returns
1 on success, 0 on failure.

◆ glColorTableEXT()

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.

Parameters
targetIgnored, only here for OpenGL compatibility.
empty1Ignored, only here for OpenGL compatibility.
widthThe length of the palette in colors (if 0, the palette is removed from currently bound texture).
empty2Ignored, only here for OpenGL compatibility.
empty3Ignored, only here for OpenGL compatibility.
tablePointer to the palette data to load. If this is NULL, the palette will be allocated but no data will be copied to it.
Returns
1 on success, 0 on failure.

◆ glCutoffDepth()

static void glCutoffDepth ( fixed12d3  wVal)
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.

Parameters
wValDistance (15 bit value).

◆ glDeleteTextures()

int glDeleteTextures ( int  n,
int *  names 
)

Deletes the specified number of textures (and associated palettes).

Parameters
nThe number of textures to delete.
namesPointer to the names array to empty.
Returns
1 on success, 0 on failure.

◆ glDisable()

static void glDisable ( int  bits)
inlinestatic

Disables various GL states (blend, alpha test, etc..).

Parameters
bitsBit mask of desired attributes, enumerated in DISP3DCNT_ENUM.

◆ glEnable()

static void glEnable ( int  bits)
inlinestatic

Enables various GL states (blend, alpha test, etc..).

Parameters
bitsBit mask of desired attributes, enumerated in DISP3DCNT_ENUM.

◆ glFlush()

static void glFlush ( u32  mode)
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.

Parameters
modeFlags from GLFLUSH_ENUM.

◆ glFogColor()

static void glFogColor ( uint8_t  red,
uint8_t  green,
uint8_t  blue,
uint8_t  alpha 
)
inlinestatic

Sets the fog color.

Parameters
redRed component (0 - 31).
greenGreen component (0 - 31).
blueBlue component (0 - 31).
alphaFrom 0 (clear) to 31 (opaque).

◆ glFogDensity()

static void glFogDensity ( int  index,
int  density 
)
inlinestatic

Sets the fog density at a given index.

Parameters
indexFog table index to operate on (0 to 31).
densityFog density from 0 (none) to 127 (opaque).

◆ glFogOffset()

static void glFogOffset ( int  offset)
inlinestatic

Sets the FOG_OFFSET value.

Fog begins at this depth with a density of FOG_TABLE[0].

Parameters
offsetFOG_OFFSET value.

◆ glFogShift()

static void glFogShift ( int  shift)
inlinestatic

Sets the FOG_SHIFT value.

Each entry of the fog table covers 0x400 >> FOG_SHIFT depth values.

Parameters
shiftFOG_SHIFT value.

◆ glFrustum()

static void glFrustum ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)
inlinestatic

Specifies the viewing frustum for the projection matrix (floating point version).

Parameters
leftLeft of a rectangle located at the near clipping plane.
rightRight of a rectangle located at the near clipping plane.
topTop of a rectangle located at the near clipping plane.
bottomBottom of a rectangle located at the near clipping plane.
nearLocation of a the near clipping plane (parallel to viewing window).
farLocation of a the far clipping plane (parallel to viewing window).
Warning
Float version! Please, use glFrustumf32() instead.

◆ glFrustumf32()

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).

Parameters
leftLeft of a rectangle located at the near clipping plane.
rightRight of a rectangle located at the near clipping plane.
topTop of a rectangle located at the near clipping plane.
bottomBottom of a rectangle located at the near clipping plane.
nearLocation of a the near clipping plane (parallel to viewing window).
farLocation of a the far clipping plane (parallel to viewing window).

◆ glGenTextures()

int glGenTextures ( int  n,
int *  names 
)

Creates room for the specified number of textures.

Parameters
nThe number of textures to generate.
namesPointer to the names array to fill.
Returns
1 on success, 0 on failure.

◆ glGetColorTableEXT()

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.

Parameters
targetIgnored, only here for OpenGL compatibility.
empty1Ignored, only here for OpenGL compatibility.
empty2Ignored, only here for OpenGL compatibility.
tablePointer where palette data will be written to.
Returns
1 on success, 0 on failure.

◆ glGetColorTableParameterEXT()

int glGetColorTableParameterEXT ( int  target,
int  pname,
int *  params 
)

glGetColorTableParameterEXT retrieves information pertaining to the currently bound texture's palette.

Parameters
targetIgnored, only here for OpenGL compatibility.
pnameA parameter of type GL_TEXTURE_PALETTE_PARAM_ENUM, used to read a specific attribute into params
paramsThe destination for the attribute to read into.
Returns
1 on success, 0 on failure.

◆ glGetColorTablePointer()

void * glGetColorTablePointer ( int  name)

Returns the address alocated to the palette of the texture named by name.

Parameters
nameThe name of the texture to get a pointer to.
Returns
The address.

◆ glGetFixed()

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).

Parameters
paramThe state variable to retrieve.
fPointer with room to hold the requested data.

◆ glGetInt()

void glGetInt ( GL_GET_ENUM  param,
int *  i 
)

Grabs integer state variables from OpenGL.

Parameters
paramThe state variable to retrieve
iPointer with room to hold the requested data

◆ glGetTexParameter()

u32 glGetTexParameter ( void  )

Returns the active texture parameter.

Returns
The parameter.

◆ glGetTextureExtPointer()

void * glGetTextureExtPointer ( int  name)

Returns address allocated to the extra compressed texure data named by name.

Parameters
nameThe name of the texture to get a pointer to.
Returns
The address, or NULL if there is no data or the format of the texture isn't GL_COMPRESSED.

◆ glGetTexturePointer()

void * glGetTexturePointer ( int  name)

Returns the address allocated to the texure named by name.

Parameters
nameThe name of the texture to get a pointer to.
Returns
The address.

◆ glInit()

int glInit ( void  )

Initializes the GL state machine (must be called once before using GL calls).

Returns
1 on success, 0 on failure

◆ glLight()

static void glLight ( int  id,
rgb  color,
v10  x,
v10  y,
v10  z 
)
inlinestatic

Set up a light.

Only parallel light sources are supported on the DS. Also, the direction must be normalized.

Parameters
idThe number of the light to setup.
colorThe color of the light.
xX component of the lights directional vector.
yY component of the lights directional vector.
zZ component of the lights directional vector.

◆ glLoadMatrix4x3()

static void glLoadMatrix4x3 ( const m4x3 m)
inlinestatic

Loads a 4x3 matrix into the current matrix.

Parameters
mPointer to a 4x3 matrix.

◆ glLoadMatrix4x4()

static void glLoadMatrix4x4 ( const m4x4 m)
inlinestatic

Loads a 4x4 matrix into the current matrix.

Parameters
mPointer to a 4x4 matrix.

◆ glLockVRAMBank()

int glLockVRAMBank ( uint16_t *  addr)

Locks a designated VRAM bank to prevent consideration of the bank when allocating textures.

Parameters
addrThe base address of the VRAM bank.
Returns
1 on success, 0 on failure.

◆ glMaterialf()

void glMaterialf ( GL_MATERIALS_ENUM  mode,
rgb  color 
)

Specify the material properties to be used in rendering lit polygons.

Parameters
modeWhich material property to change.
colorThe color to set for that material property.

◆ glMatrixMode()

static void glMatrixMode ( GL_MATRIX_MODE_ENUM  mode)
inlinestatic

Change the current matrix mode.

Parameters
modeNew mode for the matrix.

◆ glMultMatrix3x3()

static void glMultMatrix3x3 ( const m3x3 m)
inlinestatic

Multiplies the current matrix by a 3x3 matrix.

Parameters
mPointer to a 3x3 matrix.

◆ glMultMatrix4x3()

static void glMultMatrix4x3 ( const m4x3 m)
inlinestatic

Multiplies the current matrix by a 4x3 matrix.

Parameters
mPointer to a 4x3 matrix.

◆ glMultMatrix4x4()

static void glMultMatrix4x4 ( const m4x4 m)
inlinestatic

Multiplies the current matrix by a 4x4 matrix.

Parameters
mPointer to a 4x4 matrix.

◆ glNormal()

static void glNormal ( u32  normal)
inlinestatic

The normal to use for the following vertices.

Parameters
normalThe packed normal (three 10 bit values: x, y, z).
Warning
The nature of the format means that you can't represent the following normals exactly: (0,0,1), (0,1,0), (1,0,0)

◆ glNormal3f()

static void glNormal3f ( float  x,
float  y,
float  z 
)
inlinestatic

The normal to use for following vertices.

Parameters
xX component of the normal, vector must be normalized.
yY component of the normal, vector must be normalized.
zZ component of the normal, vector must be normalized.
Warning
Float version! Please use glNormal() instead.

◆ glOrtho()

static void glOrtho ( float  left,
float  right,
float  bottom,
float  top,
float  zNear,
float  zFar 
)
inlinestatic

Multiplies the current matrix into ortho graphic mode.

Parameters
leftLeft vertical clipping plane.
rightRight vertical clipping plane.
bottomBottom vertical clipping plane.
topTop vertical clipping plane.
zNearNear clipping plane.
zFarFar clipping plane.
Warning
Float version! Please, use glOrthof32() instead.

◆ glOrthof32()

void glOrthof32 ( int  left,
int  right,
int  bottom,
int  top,
int  zNear,
int  zFar 
)

Multiplies the current matrix into orthographic mode.

Parameters
leftLeft vertical clipping plane.
rightRight vertical clipping plane.
bottomBottom vertical clipping plane.
topTop vertical clipping plane.
zNearNear clipping plane.
zFarFar clipping plane.

◆ glPolyFmt()

static void glPolyFmt ( u32  params)
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().

Parameters
paramsThe paramters to set for the following polygons.

◆ glPopMatrix()

static void glPopMatrix ( int  num)
inlinestatic

Pops the specified number of matrices from the stack.

Parameters
numThe number of matrices to pop.

◆ glRestoreMatrix()

static void glRestoreMatrix ( int  index)
inlinestatic

Restores the current matrix from a location in the stack.

Parameters
indexThe location in the stack.

◆ glRotatef()

static void glRotatef ( float  angle,
float  x,
float  y,
float  z 
)
inlinestatic

Rotate about an arbitrary axis.

Parameters
xThe x component of the axis to rotate on.
yThe y component of the axis to rotate on.
zThe z component of the axis to rotate on.
angleThe angle to rotate by.

◆ glRotatef32()

static void glRotatef32 ( float  angle,
int  x,
int  y,
int  z 
)
inlinestatic

Rotate on an arbitrary axis.

Parameters
angleThe angle to rotate by
xThe x component of the axis to rotate on.
yThe y component of the axis to rotate on.
zThe z component of the axis to rotate on.
Warning
Float version! Please, use glRotatef32i() instead.

◆ glRotatef32i()

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.

Parameters
angleThe angle to rotate by
xX component of the unit vector axis.
yY component of the unit vector axis.
zZ component of the unit vector axis.

◆ glRotateX()

static void glRotateX ( float  angle)
inlinestatic

Rotates the current modelview matrix by angle degrees around the X axis.

Parameters
angleThe angle to rotate by.
Warning
Float version! Please, use glRotateZi() instead.

◆ glRotateXi()

static void glRotateXi ( int  angle)
inlinestatic

Rotates the current modelview matrix by angle around the X axis.

Parameters
angleThe angle to rotate by (angle is -32768 to 32767).

◆ glRotateY()

static void glRotateY ( float  angle)
inlinestatic

Rotates the current modelview matrix by angle degrees around the Y axis.

Parameters
angleThe angle to rotate by.
Warning
Float version! Please, use glRotateZi() instead.

◆ glRotateYi()

static void glRotateYi ( int  angle)
inlinestatic

Rotates the current modelview matrix by angle around the Y axis.

Parameters
angleThe angle to rotate by (angle is -32768 to 32767).

◆ glRotateZ()

static void glRotateZ ( float  angle)
inlinestatic

Rotates the current modelview matrix by angle degrees around the Z axis.

Parameters
angleThe angle to rotate by.
Warning
Float version! Please, use glRotateZi() instead.

◆ glRotateZi()

static void glRotateZi ( int  angle)
inlinestatic

Rotates the current modelview matrix by angle around the Z axis.

Parameters
angleThe angle to rotate by (angle is -32768 to 32767).

◆ glScalef()

static void glScalef ( float  x,
float  y,
float  z 
)
inlinestatic

Multiply the current matrix by a scale matrix.

Parameters
xScaling on the x axis.
yScaling on the y axis.
zScaling on the z axis.
Warning
Float version! Please, use glScalev() or glScalef32() instead.

◆ glScalef32()

static void glScalef32 ( int  x,
int  y,
int  z 
)
inlinestatic

Multiply the current matrix by a scale matrix.

Parameters
xScaling on the x axis.
yScaling on the y axis.
zScaling on the z axis.

◆ glScalev()

static void glScalev ( const GLvector v)
inlinestatic

Multiply the current matrix by a scale matrix.

Parameters
vThe vector to scale by.

◆ glSetOutlineColor()

static void glSetOutlineColor ( int  id,
rgb  color 
)
inlinestatic

Specifies an edge color for polygons.

Parameters
idWhich outline color to set (0 - 7).
colorThe 15 bit color to set

◆ glSetToonTable()

static void glSetToonTable ( const uint16_t *  table)
inlinestatic

Loads a toon table.

Parameters
tablePointer to the 32 color palette to load into the toon table.

◆ glSetToonTableRange()

static void glSetToonTableRange ( int  start,
int  end,
rgb  color 
)
inlinestatic

Sets a range of colors on the toon table.

Parameters
startThe start of the range
endThe end of the range
colorThe color to set for that range *‍/

◆ glStoreMatrix()

static void glStoreMatrix ( int  index)
inlinestatic

Place the current matrix into the stack at the specified location.

Parameters
indexThe location in the stack.

◆ glTexCoord2f()

void glTexCoord2f ( float  s,
float  t 
)

Sets texture coordinates for following vertices.

Parameters
sS (a.k.a. U) texture coordinate (0.0 - 1.0).
tT (a.k.a. V) texture coordinate (0.0 - 1.0).
Warning
Float version! Please, use glTexCoord2t16() instead.

◆ glTexCoord2f32()

void glTexCoord2f32 ( int32_t  u,
int32_t  v 
)

Sets texture coordinates for following vertices (fixed point version).

Parameters
uU (a.k.a. S) texture coordinate (0.0 - 1.0).
vV (a.k.a. T) texture coordinate (0.0 - 1.0).

◆ glTexCoord2i()

static void glTexCoord2i ( t16  u,
t16  v 
)
inlinestatic

Sets texture coordinates for the following vertices.

Parameters
uU (a.k.a. S) texture coordinate in texels (12.0 format).
vV (a.k.a. T) texture coordinate in texels (12.0 format).

◆ glTexCoord2t16()

static void glTexCoord2t16 ( t16  u,
t16  v 
)
inlinestatic

Sets texture coordinates for the following vertices.

Parameters
uU (a.k.a. S) texture coordinate in texels (12.4 format).
vV (a.k.a. T) texture coordinate in texels (12.4 format).

◆ glTexImage2D()

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.

Parameters
targetIgnored, only here for OpenGL compatibility.
empty1Ignored, only here for OpenGL compatibility.
typeThe format of the texture.
sizeXWidth of the texture (in pixels or GL_TEXTURE_SIZE_ENUM values).
sizeYHeight of the texture (in pixels or GL_TEXTURE_SIZE_ENUM values).
empty2Ignored, only here for OpenGL compatibility.
paramParameters of the texture.
texturePointer to the texture data to load. If this is NULL, the texture will be allocated but no data will be copied to it.
Returns
1 on success, 0 on failure.

◆ glTexParameter()

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.

Parameters
targetIgnored, only here for OpenGL compatibility.
paramParamaters for the texture.
Returns
1 on success, 0 on failure.

◆ glTexSizeToEnum()

static enum GL_TEXTURE_SIZE_ENUM glTexSizeToEnum ( int  size)
inlinestatic

This converts a size in pixels to a GL_TEXTURE_SIZE_ENUM value.

Note: This is not a real OpenGL function.

Parameters
sizeSize in pixels.
Returns
A valid GL_TEXTURE_SIZE_ENUM value (TEXTURE_SIZE_INVALID if the size is invalid).

◆ glTranslatef()

static void glTranslatef ( float  x,
float  y,
float  z 
)
inlinestatic

Multiply the current matrix by a translation matrix.

Parameters
xTranslation on the x axis.
yTranslation on the y axis.
zTranslation on the z axis.
Warning
Float version! Please, use glTranslatef32() instead.

◆ glTranslatef32()

static void glTranslatef32 ( int  x,
int  y,
int  z 
)
inlinestatic

Multiply the current matrix by a translation matrix.

Parameters
xTranslation on the x axis.
yTranslation on the y axis.
zTranslation on the z axis.

◆ glTranslatev()

static void glTranslatev ( const GLvector v)
inlinestatic

Multiply the current matrix by a translation matrix.

Parameters
vThe vector to translate by.

◆ gluLookAt()

static void gluLookAt ( float  eyex,
float  eyey,
float  eyez,
float  lookAtx,
float  lookAty,
float  lookAtz,
float  upx,
float  upy,
float  upz 
)
inlinestatic

Places the camera at the specified location and orientation (floating point version).

Parameters
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.
upxUnit vector describing which direction is up for the camera.
upyUnit vector describing which direction is up for the camera.
upzUnit vector describing which direction is up for the camera.
Warning
Float version! Please, use gluLookAtf32() instead.

◆ gluLookAtf32()

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).

Parameters
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.
upxUnit vector describing which direction is up for the camera.
upyUnit vector describing which direction is up for the camera.
upzUnit vector describing which direction is up for the camera.

◆ glUnlockVRAMBank()

int glUnlockVRAMBank ( uint16_t *  addr)

Unlocks a designated VRAM bank to allow consideration of the bank when allocating textures.

Parameters
addrThe base address of the VRAM bank.
Returns
1 on success, 0 on failure.

◆ gluPerspective()

static void gluPerspective ( float  fovy,
float  aspect,
float  zNear,
float  zFar 
)
inlinestatic

Utility function that sets up the projection matrix (floating point version)

Parameters
fovySpecifies the field of view in degrees.
aspectSpecifies the aspect ratio of the screen (normally screen width/screen height).
zNearSpecifies the near clipping plane.
zFarSpecifies the far clipping plane.
Warning
Float version! Please, use gluPerspectivef32() instead.

◆ gluPerspectivef32()

void gluPerspectivef32 ( int  fovy,
int  aspect,
int  zNear,
int  zFar 
)

Utility function which sets up the projection matrix (fixed point version).

Parameters
fovySpecifies the field of view in degrees (-32768 to 32767).
aspectSpecifies the aspect ratio of the screen (normally screen width divided by screen height).
zNearSpecifies the near clipping plane.
zFarSpecifies the far clipping plane.

◆ gluPickMatrix()

void gluPickMatrix ( int  x,
int  y,
int  width,
int  height,
const int  viewport[4] 
)

Utility function which generates a picking matrix for selection.

Parameters
x2D x of center (touch x normally).
y2D y of center (touch y normally).
widthWidth in pixels of the window (3 or 4 is a good number).
heightHeight in pixels of the window (3 or 4 is a good number).
viewportThe current viewport (normally {0, 0, 255, 191}).

◆ glVertex2v16()

static void glVertex2v16 ( v16  x,
v16  y 
)
inlinestatic

Specifies a new vertex by its X and Y components.

The Z component is the same as the last vertex sent to the GPU.

Parameters
xThe x component for the vertex.
yThe y component for the vertex.

◆ glVertex3f()

static void glVertex3f ( float  x,
float  y,
float  z 
)
inlinestatic

Specifies a vertex location.

Parameters
xThe x component of the vertex.
yThe y component of the vertex.
zThe z component of the vertex.
Warning
Float version! Please, use glVertex3v16() instead.

◆ glVertex3v16()

static void glVertex3v16 ( v16  x,
v16  y,
v16  z 
)
inlinestatic

Specifies a vertex.

Parameters
xThe x component for the vertex.
yThe y component for the vertex.
zThe z component for the vertex.

◆ glViewport()

static void glViewport ( uint8_t  x1,
uint8_t  y1,
uint8_t  x2,
uint8_t  y2 
)
inlinestatic

Specify the viewport for following drawing.

It can be set several times per frame.

Parameters
x1The left of the viewport.
y1The bottom of the viewport.
x2The right of the viewport.
y2The top of the viewport.

◆ POLY_ALPHA()

static u32 POLY_ALPHA ( u32  n)
inlinestatic

Used in glPolyFmt() to set the alpha level for the following polygons.

Set to 0 for wireframe mode.

Parameters
nThe level of alpha (0 - 31).
Returns
Value to be used by glPolyFmt().

◆ POLY_ID()

static u32 POLY_ID ( u32  n)
inlinestatic

Used in glPolyFmt() to set the polygon ID for the following polygons.

Parameters
nThe ID to set for following polygons (0 - 63).
Returns
Value to be used by glPolyFmt().