libnds
|
openGL (ish) interface to DS 3D hardware. More...
#include "nds/dma.h"
#include "nds/ndstypes.h"
#include "nds/arm9/sassert.h"
#include "nds/arm9/video.h"
#include "nds/arm9/cache.h"
#include "nds/arm9/trig_lut.h"
#include "nds/arm9/math.h"
#include "nds/arm9/dynamicArray.h"
Data Structures | |
struct | GLvector |
Holds a Vector related functions: glScalev(), glTranslatev() More... | |
struct | m3x3 |
Holds a Matrix of 3x3. More... | |
struct | m4x3 |
Holds a Matrix of 4x3. More... | |
struct | m4x4 |
Holds a Matrix of 4x4. 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) |
f32 to v16 | |
#define | FIFO_BEGIN REG2ID(GFX_BEGIN) |
packed command that starts a polygon vertex list GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices | |
#define | FIFO_CLEAR_COLOR REG2ID(GFX_CLEAR_COLOR) |
packed command for clear color of the rear plane GBATEK http://problemkaputt.de/gbatek.htm#ds3drearplane | |
#define | FIFO_CLEAR_DEPTH REG2ID(GFX_CLEAR_DEPTH) |
sets depth of the rear plane GBATEK http://problemkaputt.de/gbatek.htm#ds3drearplane | |
#define | FIFO_COLOR REG2ID(GFX_COLOR) |
packed command for vertex color directly GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonattributes | |
#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) |
packed command for setting diffuse and ambient material properties for the following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters | |
#define | FIFO_END REG2ID(GFX_END) |
packed command that has no discernable effect, it's probably best to never use it since it bloats the size of the list. GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices | |
#define | FIFO_FLUSH REG2ID(GFX_FLUSH) |
packed command that has the same effect as swiWaitForVBlank() GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol | |
#define | FIFO_LIGHT_COLOR REG2ID(GFX_LIGHT_COLOR) |
packed command for color for a light GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters | |
#define | FIFO_LIGHT_VECTOR REG2ID(GFX_LIGHT_VECTOR) |
packed command for direction of a light source GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters | |
#define | FIFO_NOP REG2ID(GFX_FIFO) |
packed command for nothing, just here to pad your command lists | |
#define | FIFO_NORMAL REG2ID(GFX_NORMAL) |
packed command for normal for following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters | |
#define | FIFO_PAL_FORMAT REG2ID(GFX_PAL_FORMAT) |
packed command for texture palette attributes GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes | |
#define | FIFO_POLY_FORMAT REG2ID(GFX_POLY_FORMAT) |
packed command for setting polygon attributes GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonattributes | |
#define | FIFO_SHININESS REG2ID(GFX_SHININESS) |
packed command for setting the shininess table to be used for the following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters | |
#define | FIFO_SPECULAR_EMISSION REG2ID(GFX_SPECULAR_EMISSION) |
packed command for setting specular and emmissive material properties for the following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters | |
#define | FIFO_STATUS REG2ID(GFX_STATUS) |
packed command for geometry engine status register GBATEK http://problemkaputt.de/gbatek.htm#ds3dstatus | |
#define | FIFO_TEX_COORD REG2ID(GFX_TEX_COORD) |
packed command for a texture coordinate GBATEK http://problemkaputt.de/gbatek.htm#ds3dtexturecoordinates | |
#define | FIFO_TEX_FORMAT REG2ID(GFX_TEX_FORMAT) |
packed command for texture format GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureformats | |
#define | FIFO_VERTEX10 REG2ID(GFX_VERTEX10) |
packed command for a vertex with 3 10bit paramaters (and 2bits of padding) GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices | |
#define | FIFO_VERTEX16 REG2ID(GFX_VERTEX16) |
packed command for a vertex with 3 16bit paramaters (and 16bits of padding) GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices | |
#define | FIFO_VERTEX_XY REG2ID(GFX_VERTEX_XY) |
packed command for a vertex with 2 16bit paramaters (reusing current last-set vertex z value) GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices | |
#define | FIFO_VERTEX_XZ REG2ID(GFX_VERTEX_XZ) |
packed command for a vertex with 2 16bit paramaters (reusing current last-set vertex y value) GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices | |
#define | FIFO_VERTEX_YZ REG2ID(GFX_VERTEX_YZ) |
packed command for a vertex with 2 16bit paramaters (reusing current last-set vertex x value) GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices | |
#define | FIFO_VIEWPORT REG2ID(GFX_VIEWPORT) |
packed command for setting viewport GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol | |
#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>.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 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 32bit 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 2 t16 texture coordinate values into a 32bit 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 to v16 values into one 32bit value. | |
Typedefs | |
typedef uint16 | fixed12d3 |
Used for depth (glClearDepth, glCutoffDepth) | |
typedef struct GLvector | GLvector |
Holds a Vector related functions: glScalev(), glTranslatev() | |
typedef struct m3x3 | m3x3 |
Holds a Matrix of 3x3. | |
typedef struct m4x3 | m4x3 |
Holds a Matrix of 4x3. | |
typedef struct m4x4 | m4x4 |
Holds a Matrix of 4x4. | |
typedef unsigned short | rgb |
Holds a color value. 1bit alpha, 5bits red, 5bits green, 5bits blue. | |
typedef short | t16 |
text coordinate 12.4 fixed point | |
typedef short int | v10 |
normal .10 fixed point, NOT USED FOR 10bit VERTEXES!!! | |
typedef short int | v16 |
vertex 4.12 fixed format | |
Enumerations |
Functions | |
void | glAlphaFunc (int alphaThreshold) |
set the minimum alpha value that will be used GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol More... | |
void | glAssignColorTable (int target, int name) |
glAssignColorTable sets the active texture with a palette set with another texture More... | |
void | glBegin (GL_GLBEGIN_ENUM mode) |
Starts a polygon group. More... | |
void | glBindTexture (int target, int name) |
glBindTexure sets the current named texture to the active texture. Target is ignored as all DS textures are 2D More... | |
void | glCallList (const u32 *list) |
throws a packed list of commands into the graphics FIFO via asyncronous DMA The first 32bits is the length of the packed command list, followed by a the packed list. If you want to do this really fast then write your own code that that does this synchronously and only flushes the cache when the list is changed There is sometimes a problem when you pack the GFX_END command into a list, so don't. GFX_END is a dummy command and never needs called GBATEK http://problemkaputt.de/gbatek.htm#ds3dgeometrycommands | |
void | glClearColor (uint8 red, uint8 green, uint8 blue, uint8 alpha) |
sets the color of the rear-plane(a.k.a Clear Color/Plane) More... | |
void | glClearDepth (fixed12d3 depth) |
reset the depth buffer to this value; generally set this to GL_MAX_DEPTH. GBATEK http://problemkaputt.de/gbatek.htm#ds3drearplane More... | |
void | glClearPolyID (uint8 ID) |
sets the polygon ID of the rear-plane(a.k.a. Clear/Color Plane), useful for antialiasing and edge coloring More... | |
void | glColor (rgb color) |
Set the color for following vertices. More... | |
void | glColor3b (uint8 red, uint8 green, uint8 blue) |
Set the color for following vertices. More... | |
void | glColor3f (float r, float g, float b) |
specify a color for following vertices More... | |
void | glColorSubTableEXT (int target, int start, int count, int empty1, int empty2, const uint16 *data) |
glColorSubTableEXT loads a 15-bit color format palette into a specific spot in a currently bound texture's existing palette More... | |
void | glColorTableEXT (int target, int empty1, uint16 width, int empty2, int empty3, const uint16 *table) |
glColorTableEXT loads a 15-bit color format palette into palette memory, and sets it to the currently bound texture (can be used to remove also) More... | |
void | glCutoffDepth (fixed12d3 wVal) |
Stop the drawing of polygons that are a certain distance from the camera. GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol More... | |
int | glDeleteTextures (int n, int *names) |
Deletes the specified number of textures (and associated palettes) More... | |
void | glDisable (int bits) |
Disables various gl states (blend, alpha test, etc..) More... | |
void | glEnable (int bits) |
Enables various gl states (blend, alpha test, etc..) More... | |
void | glEnd (void) |
Ends a polygon group, this seems to be a dummy function that does absolutely nothing, feel free to never use it. | |
void | glFlush (u32 mode) |
Waits for a Vblank and swaps the buffers(like swiWaitForVBlank), but lets you specify some 3D options GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol More... | |
void | glFogColor (uint8 red, uint8 green, uint8 blue, uint8 alpha) |
sets the fog color More... | |
void | glFogDensity (int index, int density) |
sets the fog density at a given index More... | |
void | glFogOffset (int offset) |
Sets the FOG_OFFSET value. More... | |
void | glFogShift (int shift) |
Sets the FOG_SHIFT value. More... | |
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) More... | |
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) More... | |
int | glGenTextures (int n, int *names) |
Creates room for the specified number of textures. More... | |
void | glGetColorTableEXT (int target, int empty1, int empty2, uint16 *table) |
glGetColorTableEXT retrieves a 15-bit color format palette from the palette memory of the currently bound texture More... | |
void | glGetFixed (const GL_GET_ENUM param, int *f) |
Grabs 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 hold the data that is in OpenGL's one modelview matrix. (a.k.a. modelview = postion and vector) http://problemkaputt.de/gbatek.htm#ds3diomap More... | |
void | glGetInt (GL_GET_ENUM param, int *i) |
Grabs integer state variables from openGL. More... | |
u32 | glGetTexParameter (void) |
Returns the active texture parameter (constructed from internal call to glTexParameter) | |
void * | glGetTexturePointer (int name) |
returns the address alocated to the texure named by name More... | |
void | glInit () |
Initializes the gl state machine (must be called once before using gl calls) | |
void | glLight (int id, rgb color, v10 x, v10 y, v10 z) |
set a light up. Only parallel light sources are supported on the DS GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters More... | |
void | glLoadIdentity (void) |
loads an identity matrix to the current matrix, same as glIdentity(void) | |
void | glLoadMatrix4x3 (const m4x3 *m) |
Loads a 4x3 matrix into the current matrix. More... | |
void | glLoadMatrix4x4 (const m4x4 *m) |
Loads a 4x4 matrix into the current matrix. More... | |
void | glMaterialf (GL_MATERIALS_ENUM mode, rgb color) |
specify the material properties to be used in rendering lit polygons More... | |
void | glMaterialShinyness (void) |
The DS uses a table for shininess..this generates a half-ass one. | |
void | glMatrixMode (GL_MATRIX_MODE_ENUM mode) |
change the current matrix mode GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply More... | |
void | glMultMatrix3x3 (const m3x3 *m) |
multiplies the current matrix by m More... | |
void | glMultMatrix4x3 (const m4x3 *m) |
multiplies the current matrix by More... | |
void | glMultMatrix4x4 (const m4x4 *m) |
Multiplies the current matrix by m. More... | |
void | glNormal (u32 normal) |
the normal to use for following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters More... | |
void | glNormal3f (float x, float y, float z) |
the normal to use for following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters More... | |
void | glOrtho (float left, float right, float bottom, float top, float zNear, float zFar) |
Multiplies the current matrix into ortho graphic mode. More... | |
void | glOrthof32 (int left, int right, int bottom, int top, int zNear, int zFar) |
Multiplies the current matrix into ortho graphic mode. More... | |
void | glPolyFmt (u32 params) |
Set the parameters for polygons rendered on the current frame GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonattributes More... | |
void | glPopMatrix (int num) |
Pops num matrices off the stack GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixstack More... | |
void | glPushMatrix (void) |
Pushes the current matrix onto the stack GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixstack | |
void | glResetMatrixStack (void) |
Resets matrix stack to top level. | |
void | glResetTextures (void) |
Resets the gl texture state freeing all texture and texture palette memory. | |
void | glRestoreMatrix (int index) |
Restores the current matrix from a location in the stack GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixstack More... | |
void | glRotatef (float angle, float x, float y, float z) |
Rotate about an arbitrary axis. More... | |
void | glRotatef32 (float angle, int x, int y, int z) |
Rotate on an arbitrary axis. More... | |
void | glRotatef32i (int angle, int32 x, int32 y, int32 z) |
Rotates the model view matrix by angle about the specified unit vector. More... | |
void | glRotateX (float angle) |
Rotates the current modelview matrix by angle degrees about the x axis. More... | |
void | glRotateXi (int angle) |
Rotates the current modelview matrix by angle about the x axis. More... | |
void | glRotateY (float angle) |
Rotates the current modelview matrix by angle degrees about the y axis. More... | |
void | glRotateYi (int angle) |
Rotates the current modelview matrix by angle about the y axis. More... | |
void | glRotateZ (float angle) |
Rotates the current modelview matrix by angle degrees about the z axis. More... | |
void | glRotateZi (int angle) |
Rotates the current modelview matrix by angle about the z axis. More... | |
void | glScalef (float x, float y, float z) |
multiply the current matrix by a scale matrix GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply More... | |
void | glScalef32 (int x, int y, int z) |
multiply the current matrix by a scale matrix GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply More... | |
void | glScalev (const GLvector *v) |
multiply the current matrix by a translation matrix GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply More... | |
void | glSetOutlineColor (int id, rgb color) |
Specifies an edge color for polygons. More... | |
void | glSetToonTable (const uint16 *table) |
Loads a toon table. More... | |
void | glSetToonTableRange (int start, int end, rgb color) |
Sets a range of colors on the toon table. More... | |
void | glStoreMatrix (int index) |
Place the current matrix into the stack at a location GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixstack More... | |
void | glTexCoord2f (float s, float t) |
Sets texture coordinates for following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes More... | |
void | glTexCoord2f32 (int32 u, int32 v) |
Sets texture coordinates for following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes More... | |
void | glTexCoord2t16 (t16 u, t16 v) |
Sets texture coordinates for following vertices GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes More... | |
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. More... | |
void | glTexParameter (int target, int param) |
Set parameters for the current texture. Although named the same as its gl counterpart, it is not compatible. Effort may be made in the future to make it so. More... | |
void | glTranslatef (float x, float y, float z) |
multiply the current matrix by a translation matrix GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply More... | |
void | glTranslatef32 (int x, int y, int z) |
multiply the current matrix by a translation matrix GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply More... | |
void | glTranslatev (const GLvector *v) |
multiply the current matrix by a translation matrix GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply More... | |
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) More... | |
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) More... | |
void | gluPerspective (float fovy, float aspect, float zNear, float zFar) |
Utility function which sets up the projection matrix (floating point version) More... | |
void | gluPerspectivef32 (int fovy, int aspect, int zNear, int zFar) |
Utility function which sets up the projection matrix (fixed point version) More... | |
void | gluPickMatrix (int x, int y, int width, int height, const int viewport[4]) |
Utility function which generates a picking matrix for selection. More... | |
void | glVertex3f (float x, float y, float z) |
specifies a vertex location More... | |
void | glVertex3v16 (v16 x, v16 y, v16 z) |
specifies a vertex More... | |
void | glViewport (uint8 x1, uint8 y1, uint8 x2, uint8 y2) |
specify the viewport for following drawing, can be set several times per frame. GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol More... | |
u32 | POLY_ALPHA (u32 n) |
used in glPolyFmt() to set the alpha level for the following polygons, set to 0 for wireframe mode More... | |
u32 | POLY_ID (u32 n) |
used in glPolyFmt() to set the Polygon ID for the following polygons More... | |
openGL (ish) interface to DS 3D hardware.
enum DISP3DCNT_ENUM |
3D Display Control Register Enums
GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol
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 |
nable/disable edge antialiasing; polygons must have different polygon IDs for the effect to work and the rear plane must be clear |
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 |
enable = fade into background?; disable = don't fade? |
GL_FOG |
enables/disables fog |
GL_COLOR_UNDERFLOW |
enable = color buffer underflow, setting resets overflow flag; disable = no color buffer overflow |
GL_POLY_OVERFLOW |
enable = polygon/vertex buffer overflow, setting resets overflow flag; disable = no polygon/vertex buffer overflow |
GL_CLEAR_BMP |
rear/clear plane is in BMP mode; disable = rear/color plane is in clear mode |
enum GL_GET_ENUM |
Enums for reading stuff from the geometry engine
http://problemkaputt.de/gbatek.htm#ds3diomap
related functions: glGetInt(), glGetFixed()
Enumerator | |
---|---|
GL_GET_VERTEX_RAM_COUNT |
returns a count of vertexes currently stored in hardware vertex ram. Use glGetInt() to retrieve |
GL_GET_POLYGON_RAM_COUNT |
returns a count of polygons currently stored in hardware polygon ram. Use glGetInt() to retrieve |
GL_GET_MATRIX_VECTOR |
returns the current 3x3 directional vector matrix. Use glGetFixed() to retrieve |
GL_GET_MATRIX_POSITION |
returns the current 4x4 position matrix. Use glGetFixed() to retrieve |
GL_GET_MATRIX_PROJECTION |
returns the current 4x4 projection matrix. Use glGetFixed() to retrieve |
GL_GET_MATRIX_CLIP |
returns the current 4x4 clip matrix. Use glGetFixed() to retrieve |
GL_GET_TEXTURE_WIDTH |
returns the width of the currently bound texture. Use glGetInt() to retrieve |
GL_GET_TEXTURE_HEIGHT |
returns the height of the currently bound texture. Use glGetInt() to retrieve |
enum GL_GLBEGIN_ENUM |
Enums selecting polygon draw mode
GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygondefinitionsbyvertices
related functions: glBegin()
enum GL_MATERIALS_ENUM |
Enums for setting up materials
GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters
related functions: glMaterialf()
enum GL_MATRIX_MODE_ENUM |
Enums selecting matrix mode
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
related functions: glMatrixMode()
Enumerator | |
---|---|
GL_PROJECTION |
used to set the Projection Matrix |
GL_POSITION |
used to set the Position Matrix |
GL_MODELVIEW |
used to set the Modelview Matrix |
GL_TEXTURE |
used to set the Texture Matrix |
enum GL_POLY_FORMAT_ENUM |
Enums for setting how polygons will be displayed
GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonattributes
related functions: glPolyFmt(), glInit(), POLY_ALPHA(), POLY_ID()
Enums for texture parameters, such as texture wrapping and texture coord stuff
GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes
related functions: glTexImage2d(), glTexParameter()
enum GL_TEXTURE_SIZE_ENUM |
Enums for size of a texture, specify one for horizontal and one for vertical related functions: glTexImage2d(), glTexParameter()
enum GL_TEXTURE_TYPE_ENUM |
Enums for texture formats
GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureformats
related functions: glTexImage2d(), glTexParameter()
enum GLFLUSH_ENUM |
Enums for glFlush()
GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol
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 |
|
inline |
set the minimum alpha value that will be used
GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol
alphaThreshold | minimum alpha value that will be used (0-15) |
void glAssignColorTable | ( | int | target, |
int | name | ||
) |
glAssignColorTable sets the active texture with a palette set with another texture
target | ignored, only here for OpenGL compatability (not really, since this isn't in OpenGL) |
name | the name(int value) of the texture to load a palette from |
|
inline |
Starts a polygon group.
mode | the draw mode for the polygon |
void glBindTexture | ( | int | target, |
int | name | ||
) |
glBindTexure sets the current named texture to the active texture. Target is ignored as all DS textures are 2D
target | ignored, only here for OpenGL compatability |
name | the name(int value) to set to the current texture |
sets the color of the rear-plane(a.k.a Clear Color/Plane)
red | component (0-31) |
green | component (0-31) |
blue | component (0-31) |
alpha | from 0(clear) to 31(opaque) |
|
inline |
reset the depth buffer to this value; generally set this to GL_MAX_DEPTH.
GBATEK http://problemkaputt.de/gbatek.htm#ds3drearplane
depth | Something to do with the depth buffer, generally set to GL_MAX_DEPTH |
|
inline |
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 |
|
inline |
Set the color for following vertices.
color | the 15bit color value |
Set the color for 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 |
|
inline |
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 |
void glColorSubTableEXT | ( | int | target, |
int | start, | ||
int | count, | ||
int | empty1, | ||
int | empty2, | ||
const uint16 * | data | ||
) |
glColorSubTableEXT 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 compatability |
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 compatability |
empty2 | ignored, only here for OpenGL compatability |
data | pointer to the palette data to load |
void glColorTableEXT | ( | int | target, |
int | empty1, | ||
uint16 | width, | ||
int | empty2, | ||
int | empty3, | ||
const uint16 * | table | ||
) |
glColorTableEXT loads a 15-bit color format palette into palette memory, and sets it to the currently bound texture (can be used to remove also)
target | ignored, only here for OpenGL compatability |
empty1 | ignored, only here for OpenGL compatability |
width | the length of the palette (if 0, then palette is removed from currently bound texture) |
empty2 | ignored, only here for OpenGL compatability |
empty3 | ignored, only here for OpenGL compatability |
table | pointer to the palette data to load (if NULL, then palette is removed from currently bound texture) |
|
inline |
Stop the drawing of polygons that are a certain distance from the camera.
GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol
wVal | polygons that are beyond this W-value(distance from camera) will not be drawn; 15bit 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 |
|
inline |
Disables various gl states (blend, alpha test, etc..)
bits | bit mask of desired attributes, attributes are enumerated in DISP3DCNT_ENUM |
|
inline |
Enables various gl states (blend, alpha test, etc..)
bits | bit mask of desired attributes, attributes are enumerated in DISP3DCNT_ENUM |
|
inline |
Waits for a Vblank and swaps the buffers(like swiWaitForVBlank), but lets you specify some 3D options
GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol
mode | flags from GLFLUSH_ENUM for enabling Y-sorting of translucent polygons and W-Buffering of all vertices |
sets the fog color
red | component (0-31) |
green | component (0-31) |
blue | component (0-31) |
alpha | from 0(clear) to 31(opaque) |
|
inline |
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) |
|
inline |
Sets the FOG_OFFSET value.
shift | FOG_OFFSET value; fogging begins at this depth with a density of FOG_TABLE[0] |
|
inline |
Sets the FOG_SHIFT value.
shift | FOG_SHIFT value; each entry of the fog table covers 0x400 >> FOG_SHIFT depth values |
|
inline |
Specifies the viewing frustum for the projection matrix (floating point version)
left | left right top and bottom describe a rectangle located at the near clipping plane |
right | left right top and bottom describe a rectangle located at the near clipping plane |
top | left right top and bottom describe a rectangle located at the near clipping plane |
bottom | left right top and bottom describe 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) |
|
inline |
Specifies the viewing frustum for the projection matrix (fixed point version)
left | left right top and bottom describe a rectangle located at the near clipping plane |
right | left right top and bottom describe a rectangle located at the near clipping plane |
top | left right top and bottom describe a rectangle located at the near clipping plane |
bottom | left right top and bottom describe 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 |
void glGetColorTableEXT | ( | int | target, |
int | empty1, | ||
int | empty2, | ||
uint16 * | table | ||
) |
glGetColorTableEXT retrieves a 15-bit color format palette from the palette memory of the currently bound texture
target | ignored, only here for OpenGL compatability |
empty1 | ignored, only here for OpenGL compatability |
empty2 | ignored, only here for OpenGL compatability |
table | pointer to where palette data will be written to |
|
inline |
Grabs 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 hold the data that is in OpenGL's one modelview matrix. (a.k.a. modelview = postion and vector)
http://problemkaputt.de/gbatek.htm#ds3diomap
param | The state variable to retrieve |
f | pointer with room to hold the requested data |
|
inline |
Grabs integer state variables from openGL.
param | The state variable to retrieve |
i | pointer with room to hold the requested data |
void* glGetTexturePointer | ( | int | name | ) |
returns the address alocated to the texure named by name
name | the name of the texture to get a pointer to |
set a light up. Only parallel light sources are supported on the DS
GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters
id | the number of the light to setup |
color | the color of the light |
x | the x component of the lights directional vector. Direction must be normalized |
y | the y component of the lights directional vector. Direction must be normalized |
z | the z component of the lights directional vector. Direction must be normalized |
|
inline |
Loads a 4x3 matrix into the current matrix.
m | pointer to a 4x4 matrix |
|
inline |
Loads a 4x4 matrix into the current matrix.
m | pointer to a 4x4 matrix |
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 |
|
inline |
change the current matrix mode
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
mode | the mode for the matrix |
|
inline |
multiplies the current matrix by m
m | pointer to a 3x3 matrix |
|
inline |
multiplies the current matrix by
m | pointer to a 4x3 matrix |
|
inline |
Multiplies the current matrix by m.
m | pointer to a 4x4 matrix |
|
inline |
the normal to use for following vertices
GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters
normal | the packed normal(3 * 10bit x, y, z) |
|
inline |
the normal to use for following vertices
GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonlightparameters
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 |
<convert float to v10
<convert float to v10
<convert float to v10
<Pack 3 v10 normals into a 32bit value
|
inline |
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 |
|
inline |
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 |
|
inline |
Set the parameters for polygons rendered on the current frame
GBATEK http://problemkaputt.de/gbatek.htm#ds3dpolygonattributes
params | the paramters to set for the polygons for the current frame. valid paramters are enumerated in GL_POLY_FORMAT_ENUM and in the functions POLY_ALPHA() and POLY_ID() |
|
inline |
Pops num matrices off the stack
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixstack
num | the number to pop down the stack |
|
inline |
Restores the current matrix from a location in the stack
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixstack
index | the place in the stack to restore to |
|
inline |
Rotate about 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 |
|
inline |
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 |
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. |
|
inline |
Rotates the current modelview matrix by angle degrees about the x axis.
angle | The angle to rotate by |
|
inline |
Rotates the current modelview matrix by angle about the x axis.
angle | The angle to rotate by (angle is -32768 to 32767) |
|
inline |
Rotates the current modelview matrix by angle degrees about the y axis.
angle | The angle to rotate by |
|
inline |
Rotates the current modelview matrix by angle about the y axis.
angle | The angle to rotate by (angle is -32768 to 32767) |
|
inline |
Rotates the current modelview matrix by angle degrees about the z axis.
angle | The angle to rotate by |
|
inline |
Rotates the current modelview matrix by angle about the z axis.
angle | The angle to rotate by (angle is -32768 to 32767) |
|
inline |
multiply the current matrix by a scale matrix
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
x | scaling on the x axis |
y | scaling on the y axis |
z | scaling on the z axis |
|
inline |
multiply the current matrix by a scale matrix
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
x | scaling on the x axis |
y | scaling on the y axis |
z | scaling on the z axis |
|
inline |
multiply the current matrix by a translation matrix
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
v | the vector to translate by |
|
inline |
Specifies an edge color for polygons.
id | which outline color to set (0-7) |
color | the 15bit color to set |
|
inline |
Loads a toon table.
table | pointer to the 32 color palette to load into the toon table |
|
inline |
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 |
|
inline |
Place the current matrix into the stack at a location
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixstack
index | the place in the stack to put the current matrix |
|
inline |
Sets texture coordinates for following vertices
GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes
s | S(a.k.a. U) texture coordinate (0.0 - 1.0) |
t | T(a.k.a. V) texture coordinate (0.0 - 1.0) |
<convert float to t16
<convert float to t16
Sets texture coordinates for following vertices
GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes
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 following vertices
GBATEK http://problemkaputt.de/gbatek.htm#ds3dtextureattributes
u | U(a.k.a. S) texture coordinate in texels |
v | V(a.k.a. T) texture coordinate in texels |
<Pack 2 t16 texture coordinate values into a 32bit value
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.
target | not used, just here for OpenGL compatibility |
empty1 | not used, just here for OpenGL compatibility |
type | The format of the texture |
sizeX | the horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM |
sizeY | the vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM |
empty2 | not used, just here for OpenGL compatibility |
param | parameters for the texture |
texture | pointer to the texture data to load |
void glTexParameter | ( | int | target, |
int | param | ||
) |
Set parameters for the current texture. Although named the same as its gl counterpart, it is not compatible. Effort may be made in the future to make it so.
target | not used, just here for OpenGL compatibility |
param | paramaters for the texture |
|
inline |
multiply the current matrix by a translation matrix
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
x | translation on the x axis |
y | translation on the y axis |
z | translation on the z axis |
|
inline |
multiply the current matrix by a translation matrix
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
x | translation on the x axis |
y | translation on the y axis |
z | translation on the z axis |
|
inline |
multiply the current matrix by a translation matrix
GBATEK http://problemkaputt.de/gbatek.htm#ds3dmatrixloadmultiply
v | the vector to translate by |
|
inline |
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 | <upx, upy, upz> Unit vector describing which direction is up for the camera. |
upy | <upx, upy, upz> Unit vector describing which direction is up for the camera. |
upz | <upx, upy, upz> Unit vector describing which direction is up for the camera. |
|
inline |
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 | <upx, upy, upz> Unit vector describing which direction is up for the camera. |
upy | <upx, upy, upz> Unit vector describing which direction is up for the camera. |
upz | <upx, upy, upz> Unit vector describing which direction is up for the camera. |
|
inline |
Utility function which 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 |
|
inline |
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/screen height) |
zNear | Specifies the near clipping plane |
zFar | Specifies the far clipping plane |
|
inline |
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}) |
|
inline |
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 |
<convert float to v16
<convert float to v16
<convert float to v16
specifies a vertex
x | the x component for the vertex |
y | the y component for the vertex |
z | the z component for the vertex |
specify the viewport for following drawing, can be set several times per frame.
GBATEK http://problemkaputt.de/gbatek.htm#ds3ddisplaycontrol
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) |