libnds
|
A very small and simple DS rendering lib using the 3d core to render 2D stuff. More...
#include <nds/arm9/videoGL.h>
Data Structures | |
struct | glImage |
Struct for our GL-Based Images This is our struct to hold our image attributes. You don't need to worry about this if you use the texture packer. More... | |
Enumerations |
Functions | |
void | glBegin2D (void) |
Sets up OpenGL for 2d rendering. Call this before drawing any of GL2D's drawing or sprite functions. | |
void | glBox (int x1, int y1, int x2, int y2, int color) |
Draws a Box. More... | |
void | glBoxFilled (int x1, int y1, int x2, int y2, int color) |
Draws a Filled Box. More... | |
void | glBoxFilledGradient (int x1, int y1, int x2, int y2, int color1, int color2, int color3, int color4) |
Draws a Filled Box in gradient colors. More... | |
void | glEnd2D (void) |
Issue this after drawing 2d so that we don't mess the matrix stack. The compliment of glBegin2D(). | |
static int | glGetActiveTexture () |
Returns the active texture. Use with care. Needed to achieve some effects since libnds 1.5.0. | |
void | glLine (int x1, int y1, int x2, int y2, int color) |
Draws a Line. More... | |
int | glLoadSpriteSet (glImage *sprite, const unsigned int numframes, const unsigned int *texcoords, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int param, int pallette_width, const u16 *palette, const uint8 *texture) |
Initializes our spriteset with Texture Packer generated UV coordinates Very safe and easy to use.. More... | |
int | glLoadTileSet (glImage *sprite, int tile_wid, int tile_hei, int bmp_wid, int bmp_hei, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int param, int pallette_width, const u16 *palette, const uint8 *texture) |
Initializes our Tileset (like glInitSpriteset()) but without the use of Texture Packer auto-generated files. Can only be used when tiles in a tilset are of the same dimensions. More... | |
void | glPutPixel (int x, int y, int color) |
Draws a Pixel. More... | |
void | glScreen2D (void) |
Initializes GL in 2D mode. | |
static void | glSetActiveTexture (int TextureID) |
Set the active texture. Use with care. Needed to achieve some effects since libnds 1.5.0. | |
void | glSprite (int x, int y, int flipmode, const glImage *spr) |
Draws a Sprite. More... | |
void | glSpriteOnQuad (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int uoff, int voff, int flipmode, const glImage *spr) |
Draws a Horizontaly Stretched Sprite (Clean Stretching) Useful for "Shrearing Effects". More... | |
void | glSpriteRotate (int x, int y, s32 angle, int flipmode, const glImage *spr) |
Draws a Center Rotated Sprite. More... | |
void | glSpriteRotateScale (int x, int y, s32 angle, s32 scale, int flipmode, const glImage *spr) |
Draws a Center Rotated Scaled Sprite. More... | |
void | glSpriteRotateScaleXY (int x, int y, s32 angle, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr) |
Draws a Center Rotated Axis-Exclusive Scaled Sprite. More... | |
void | glSpriteScale (int x, int y, s32 scale, int flipmode, const glImage *spr) |
Draws a Scaled Sprite. More... | |
void | glSpriteScaleXY (int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr) |
Draws an Axis Exclusive Scaled Sprite. More... | |
void | glSpriteStretchHorizontal (int x, int y, int length_x, const glImage *spr) |
Draws a Horizontaly Stretched Sprite (Clean Stretching) Useful for "Laser Effects". More... | |
void | glTriangle (int x1, int y1, int x2, int y2, int x3, int y3, int color) |
Draws a Triangle. More... | |
void | glTriangleFilled (int x1, int y1, int x2, int y2, int x3, int y3, int color) |
Draws a Filled Triangle. More... | |
void | glTriangleFilledGradient (int x1, int y1, int x2, int y2, int x3, int y3, int color1, int color2, int color3) |
Draws a Triangle in gradient colors. More... | |
enum GL_FLIP_MODE |
void glBox | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color | ||
) |
Draws a Box.
x1,y1 | Top-Left coordinate of the box. |
x2,y2 | Bottom-Right coordinate of the box. |
color | RGB15/ARGB16 color. |
void glBoxFilled | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color | ||
) |
Draws a Filled Box.
x1,y1 | Top-Left coordinate of the box. |
x2,y2 | Bottom-Right coordinate of the box. |
color | RGB15/ARGB16 color. |
void glBoxFilledGradient | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color1, | ||
int | color2, | ||
int | color3, | ||
int | color4 | ||
) |
Draws a Filled Box in gradient colors.
x1,y1 | Top-Left coordinate of the box. |
x2,y2 | Bottom-Right coordinate of the box. |
color1 | RGB15/ARGB16 color of the Top-Left corner. |
color2 | RGB15/ARGB16 color of the Bottom-Left corner. |
color3 | RGB15/ARGB16 color of the Bottom-Right corner. |
color4 | RGB15/ARGB16 color of the Top-Right corner. |
void glLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color | ||
) |
Draws a Line.
x1,y1 | Top-Left coordinate of the line. |
x2,y2 | Bottom-Right coordinate of the line. |
color | RGB15/ARGB16 color. |
int glLoadSpriteSet | ( | glImage * | sprite, |
const unsigned int | numframes, | ||
const unsigned int * | texcoords, | ||
GL_TEXTURE_TYPE_ENUM | type, | ||
int | sizeX, | ||
int | sizeY, | ||
int | param, | ||
int | pallette_width, | ||
const u16 * | palette, | ||
const uint8 * | texture | ||
) |
Initializes our spriteset with Texture Packer generated UV coordinates
Very safe and easy to use..
*sprite | Pointer to an array of glImage. |
numframes | number of frames in a spriteset (auto-generated by Texture Packer). |
*texcoords | Texture Packer auto-generated array of UV coords. |
type | The format of the texture ( see glTexImage2d() ). |
sizeX | The horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM ( see glTexImage2d() ). |
sizeY | The vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM ( see glTexImage2d() ). |
param | parameters for the texture ( see glTexImage2d() ). |
pallette_width | Length of the palette. Valid values are 4, 16, 32, 256 (if 0, then palette is removed from currently bound texture). |
*palette | Pointer to the palette data to load (if NULL, then palette is removed from currently bound texture). |
*texture | Pointer to the texture data to load. |
int glLoadTileSet | ( | glImage * | sprite, |
int | tile_wid, | ||
int | tile_hei, | ||
int | bmp_wid, | ||
int | bmp_hei, | ||
GL_TEXTURE_TYPE_ENUM | type, | ||
int | sizeX, | ||
int | sizeY, | ||
int | param, | ||
int | pallette_width, | ||
const u16 * | palette, | ||
const uint8 * | texture | ||
) |
Initializes our Tileset (like glInitSpriteset()) but without the use of Texture Packer auto-generated files.
Can only be used when tiles in a tilset are of the same dimensions.
*sprite | Pointer to an array of glImage. |
tile_wid | Width of each tile in the texture. |
tile_hei | Height of each tile in the texture. |
bmp_wid | Width of of the texture or tileset. |
bmp_hei | height of of the texture or tileset. |
type | The format of the texture ( see glTexImage2d() ). |
sizeX | The horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM ( see glTexImage2d() ). |
sizeY | The vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM ( see glTexImage2d() ). |
param | parameters for the texture ( see glTexImage2d() ). |
pallette_width | Length of the palette. Valid values are 4, 16, 32, 256 (if 0, then palette is removed from currently bound texture). |
*palette | Pointer to the palette data to load (if NULL, then palette is removed from currently bound texture). |
*texture | Pointer to the texture data to load. |
void glPutPixel | ( | int | x, |
int | y, | ||
int | color | ||
) |
Draws a Pixel.
x | X position of the pixel. |
y | Y position of the pixel. |
color | RGB15/ARGB16 color. |
void glSprite | ( | int | x, |
int | y, | ||
int | flipmode, | ||
const glImage * | spr | ||
) |
Draws a Sprite.
x | X position of the sprite. |
y | Y position of the sprite. |
flipmode | mode for flipping (see GL_FLIP_MODE enum). |
*spr | pointer to a glImage. |
void glSpriteOnQuad | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | x3, | ||
int | y3, | ||
int | x4, | ||
int | y4, | ||
int | uoff, | ||
int | voff, | ||
int | flipmode, | ||
const glImage * | spr | ||
) |
Draws a Horizontaly Stretched Sprite (Clean Stretching)
Useful for "Shrearing Effects".
x1,y1 | First corner of the sprite. |
x2,y2 | Second corner of the sprite. |
x3,y3 | Third corner of the sprite. |
x4,y4 | Fourth corner of the sprite. |
uoff,voff | texture offsets. |
flipmode | mode for flipping (see GL_FLIP_MODE enum). |
*spr | pointer to a glImage. |
Draws a Center Rotated Sprite.
x | X position of the sprite center. |
y | Y position of the sprite center. |
angle | Binary Radian Angle(-32768 to 32767) to rotate the sprite. |
flipmode | mode for flipping (see GL_FLIP_MODE enum). |
*spr | pointer to a glImage. |
Draws a Center Rotated Scaled Sprite.
x | X position of the sprite center. |
y | Y position of the sprite center. |
angle | Binary Radian Angle(-32768 to 32767) to rotate the sprite. |
scale | 20.12 fixed-point scale value (1 << 12 is normal). |
flipmode | mode for flipping (see GL_FLIP_MODE enum). |
*spr | pointer to a glImage. |
void glSpriteRotateScaleXY | ( | int | x, |
int | y, | ||
s32 | angle, | ||
s32 | scaleX, | ||
s32 | scaleY, | ||
int | flipmode, | ||
const glImage * | spr | ||
) |
Draws a Center Rotated Axis-Exclusive Scaled Sprite.
x | X position of the sprite center. |
y | Y position of the sprite center. |
angle | Binary Radian Angle(-32768 to 32767) to rotate the sprite. |
scaleX | 20.12 fixed-point X-Axis scale value (1 << 12 is normal). |
scaleY | 20.12 fixed-point Y-Axis scale value (1 << 12 is normal). |
flipmode | mode for flipping (see GL_FLIP_MODE enum). |
*spr | pointer to a glImage. |
Draws a Scaled Sprite.
x | X position of the sprite. |
y | Y position of the sprite. |
scale | 20.12 fixed-point scale value (1 << 12 is normal). |
flipmode | mode for flipping (see GL_FLIP_MODE enum). |
*spr | pointer to a glImage. |
Draws an Axis Exclusive Scaled Sprite.
x | X position of the sprite. |
y | Y position of the sprite. |
scaleX | 20.12 fixed-point X-Axis scale value (1 << 12 is normal). |
scaleY | 20.12 fixed-point Y-Axis scale value (1 << 12 is normal). |
flipmode | mode for flipping (see GL_FLIP_MODE enum). |
*spr | pointer to a glImage. |
void glSpriteStretchHorizontal | ( | int | x, |
int | y, | ||
int | length_x, | ||
const glImage * | spr | ||
) |
Draws a Horizontaly Stretched Sprite (Clean Stretching)
Useful for "Laser Effects".
x | X position of the sprite center. |
y | Y position of the sprite center. |
length_x | The length(in pixels) to stretch the sprite. |
*spr | pointer to a glImage. |
void glTriangle | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | x3, | ||
int | y3, | ||
int | color | ||
) |
Draws a Triangle.
x1,y1 | Vertex 1 of the triangle. |
x2,y2 | Vertex 2 of the triangle. |
x3,y3 | Vertex 3 of the triangle. |
color | RGB15/ARGB16 color of the triangle. |
void glTriangleFilled | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | x3, | ||
int | y3, | ||
int | color | ||
) |
Draws a Filled Triangle.
x1,y1 | Vertex 1 of the triangle. |
x2,y2 | Vertex 2 of the triangle. |
x3,y3 | Vertex 3 of the triangle. |
color | RGB15/ARGB16 color of the triangle. |
void glTriangleFilledGradient | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | x3, | ||
int | y3, | ||
int | color1, | ||
int | color2, | ||
int | color3 | ||
) |
Draws a Triangle in gradient colors.
x1,y1 | Vertex 1 of the triangle. |
x2,y2 | Vertex 2 of the triangle. |
x3,y3 | Vertex 3 of the triangle. |
color1 | RGB15/ARGB16 color of the vertex 1. |
color2 | RGB15/ARGB16 color of the vertex 2. |
color3 | RGB15/ARGB16 color of the vertex 3. |