openTRI 0.1
|
Macros | |
#define | TRI_DLIST_SIZE_KB(x) |
#define | SCREEN_WIDTH 480 |
#define | SCREEN_HEIGHT 272 |
#define | FRAME_BUFFER_WIDTH 512 |
#define | FRAME_BUFFER_SIZE (FRAME_BUFFER_WIDTH*SCREEN_HEIGHT) |
#define | TRI_ALPHA_TEST 0 |
#define | TRI_DEPTH_TEST 1 |
#define | TRI_SCISSOR_TEST 2 |
#define | TRI_STENCIL_TEST 3 |
#define | TRI_BLEND 4 |
#define | TRI_CULL_FACE 5 |
#define | TRI_DITHER 6 |
#define | TRI_FOG 7 |
#define | TRI_CLIP_PLANES 8 |
#define | TRI_TEXTURE_2D 9 |
#define | TRI_LIGHTING 10 |
#define | TRI_LIGHT0 11 |
#define | TRI_LIGHT1 12 |
#define | TRI_LIGHT2 13 |
#define | TRI_LIGHT3 14 |
#define | TRI_AALINE 15 |
#define | TRI_COLORKEY 17 |
#define | TRI_LOGICAL_OP 18 |
#define | TRI_NORMAL_REVERSE 19 |
#define | TRI_VBLANK 32 |
#define | TRI_PSEUDO_FSAA 33 |
#define | TRI_SMOOTH_DITHER 34 |
#define | TRI_DEPTH_MASK 35 |
#define | TRI_DEPTH_WRITE 35 |
Functions | |
void | triInit (triS32 psm, triBool doublebuffer) |
Initialize graphics. | |
void | triClose () |
Close graphics and free all resources. | |
void | triBegin () |
Begin an immediate render command block This is needed when you depend on the render result (e.g. | |
void | triEnd () |
End an immediate render command block. | |
void | triSync () |
Sync CPU to GU for the current immediate block. | |
void | triSwapbuffers () |
Wait for rendering to finish and swap front- and backbuffer. | |
void | triVblank () |
Wait for Vblank. | |
triFloat | triCPULoad () |
Return the current CPU load in percent. | |
triFloat | triGPULoad () |
Return the current GPU load in percent. | |
triFloat | triFps () |
Return the current FPS. | |
triFloat | triFpsMax () |
Return the maximal FPS. | |
triFloat | triFpsMin () |
Return the minimal FPS. | |
void | triPerspective (triFloat fov) |
void | triOrtho () |
void | triEnable (triU32 state) |
void | triDisable (triU32 state) |
void | triClear (triU32 color) |
void | triSetClip (triS32 x, triS32 y, triS32 width, triS32 height) |
void | triResetClip () |
void | triRendertoscreen () |
void | triRendertotexture (triS32 psm, void *tbp, triS32 tw, triS32 th, triS32 tbw) |
void | triRendertoimage (triImage *img) |
void | triCopyToScreen (triS32 x, triS32 y, triS32 w, triS32 h, triS32 sx, triS32 sy, triS32 sbw, void *src) |
void | triCopyFromScreen (triS32 x, triS32 y, triS32 w, triS32 h, triS32 dx, triS32 dy, triS32 dbw, void *dst) |
void | triDrawLine (triFloat x0, triFloat y0, triFloat x1, triFloat y1, triU32 color) |
Draw a line from (x0,y0) to (x1,y1) in color 'color'. | |
void | triDrawLines (triVec2 *p, triS32 num, triU32 color) |
Draw a line strip consisting of num points in color 'color'. | |
void | triDrawRect (triFloat x, triFloat y, triFloat width, triFloat height, triU32 color) |
Draw filled rectangle from (x,y) to (x+width,y+height) in color 'color'. | |
void | triDrawRectOutline (triFloat x, triFloat y, triFloat width, triFloat height, triU32 color) |
Draw rectangle from (x,y) to (x+width,y+height) in color 'color' with outline only. | |
void | triDrawRectRotate (triFloat x, triFloat y, triFloat width, triFloat height, triU32 color, triFloat angle) |
Draw Rectangle from (x,y) to (x+width,y+height) in color 'color' rotated by angle degree around it's center. | |
void | triDrawRectGrad (triFloat x, triFloat y, triFloat width, triFloat height, triU32 color1, triU32 color2, triU32 color3, triU32 color4) |
Draw Rectangle from (x,y) to (x+width,y+height) with gradient. | |
void | triDrawCircle (triFloat x, triFloat y, triFloat radius, triU32 color) |
Draw Circle. | |
void | triDrawCircleOutline (triFloat x, triFloat y, triFloat radius, triU32 color) |
Draw Circle (outline only) | |
void | triDrawCircleGrad (triFloat x, triFloat y, triFloat radius, triU32 color1, triU32 color2) |
Draw Circle with gradient. | |
void | triDrawTri (triFloat x0, triFloat y0, triFloat x1, triFloat y1, triFloat x2, triFloat y2, triU32 color) |
Draw arbitrary triangle. | |
void | triDrawTriOutline (triFloat x0, triFloat y0, triFloat x1, triFloat y1, triFloat x2, triFloat y2, triU32 color) |
Draw arbitrary triangle with outline only. | |
void | triDrawTriGrad (triFloat x0, triFloat y0, triFloat x1, triFloat y1, triFloat x2, triFloat y2, triU32 color1, triU32 color2, triU32 color3) |
Draw arbitrary triangle with outline only. | |
void | triDrawRegPoly (triFloat x, triFloat y, triFloat radius, triU32 color, triU32 numSteps, triFloat angle) |
Draw regular Polygon (Pentagon,Hexagon,Octagon,etc) | |
void | triDrawRegPolyOutline (triFloat x, triFloat y, triFloat radius, triU32 color, triU32 numSteps, triFloat angle) |
Draw regular Polygon (Pentagon,Hexagon,Octagon,etc) with outline only. | |
void | triDrawRegPolyGrad (triFloat x, triFloat y, triFloat radius, triU32 color1, triU32 color2, triU32 numSteps, triFloat angle) |
Draw regular Polygon (Pentagon,Hexagon,Octagon,etc) with gradient. | |
void | triDrawStar (triFloat x, triFloat y, triFloat radiusInner, triFloat radiusOuter, triU32 color, triU32 numSteps, triFloat angle) |
Draw Star. | |
void | triDrawStarOutline (triFloat x, triFloat y, triFloat radiusInner, triFloat radiusOuter, triU32 color, triU32 numSteps, triFloat angle) |
Draw Star with outline only. | |
void | triDrawStarGrad (triFloat x, triFloat y, triFloat radiusInner, triFloat radiusOuter, triU32 color1, triU32 color2, triU32 numSteps, triFloat angle) |
Draw Star with gradient. | |
void | triColorOp (triS32 op) |
void | trinoColorOp () |
void | triImageTint (triS32 mode, triS32 comp, triU32 vcolor, triU32 ccolor) |
void | triImageNoTint () |
void | triImageConstAlpha (triU32 alpha) |
void | triImageBlend (triS32 op, triS32 srcOp, triS32 dstOp, triU32 src_fix, triU32 dst_fix) |
void | triImageNoBlend () |
void | triImageColorkey (triU32 color) |
void | triImageNoColorkey () |
void | triSpriteMode (triFloat width, triFloat height, triFloat angle) |
Set sprite mode. | |
void | triDrawSprite (triFloat x, triFloat y, triFloat u, triFloat v, triImage *img) |
Render a sprite. | |
void | triBltSprite (triFloat x, triFloat y, triFloat u, triFloat v, triImage *img) |
Render a sprite without effects (no blending, transparency, etc.) | |
void | triDrawImageCenterScaled (triFloat x, triFloat y, triFloat scale, triImage *img) |
Render an image centered at position x,y scaled by a factor. | |
void | triDrawImageScaled (triFloat x, triFloat y, triFloat width, triFloat height, triImage *img) |
Render an image scaled by a factor. | |
void | triDrawImage2 (triFloat x, triFloat y, triImage *img) |
Render an image at full size. | |
void | triDrawImage (triFloat x, triFloat y, triFloat width, triFloat height, triFloat u0, triFloat v0, triFloat u1, triFloat v1, triImage *img) |
Render an image. | |
void | triDrawImageRotate2 (triFloat x, triFloat y, triFloat angle, triImage *img) |
Render an image with rotation. | |
void | triDrawImageRotate (triFloat x, triFloat y, triFloat width, triFloat height, triFloat u0, triFloat v0, triFloat u1, triFloat v1, triFloat angle, triImage *img) |
Render an image with rotation. | |
void | triDrawImageAnimation (triFloat x, triFloat y, triImageAnimation *ani) |
Render an image animation. | |
void | triDrawImageAnimationRotate (triFloat x, triFloat y, triFloat angle, triImageAnimation *ani) |
Render an image animation with rotation. | |
Variables | |
void * | triFramebuffer |
void * | triFramebuffer2 |
void * | triDepthbuffer |
triS32 | triPsm |
triS32 | triBpp |
#define TRI_DLIST_SIZE_KB | ( | x | ) |
void triInit | ( | triS32 | psm, |
triBool | doublebuffer ) |
Initialize graphics.
psm | Pixelformat to set output to (one of GU_PSM_4444,GU_PSM_5551,GU_PSM_5650 or GU_PSM_8888) |
doublebuffer | Whether to use doublebuffering or not. |
mode pixelformat Free VRAM (bytes) double 16bit (no depth) 1,540,096 double 32bit (no depth) 983,040 double 16bit (depth) 1,261,568 double 32bit (depth) 704,512 triple 16bit (no depth) 1,818,624 triple 32bit (no depth) 1,540,096 triple 16bit (depth) 1,540,096 triple 32bit (depth) 1,261,568
void triBegin | ( | ) |
Begin an immediate render command block This is needed when you depend on the render result (e.g.
for renderbuffer effects)
void triVblank | ( | ) |
Wait for Vblank.
Will do nothing if TRI_VBLANK is already enabled.
triFloat triCPULoad | ( | ) |
Return the current CPU load in percent.
triFloat triGPULoad | ( | ) |
Return the current GPU load in percent.
triFloat triFps | ( | ) |
Return the current FPS.
triFloat triFpsMax | ( | ) |
Return the maximal FPS.
triFloat triFpsMin | ( | ) |
Return the minimal FPS.
void triDrawLine | ( | triFloat | x0, |
triFloat | y0, | ||
triFloat | x1, | ||
triFloat | y1, | ||
triU32 | color ) |
Draw a line from (x0,y0) to (x1,y1) in color 'color'.
x0 | X position of first point |
y0 | Y position of first point |
x1 | X position of second point |
y1 | Y position of second point |
color | Color of line |
void triDrawLines | ( | triVec2 * | p, |
triS32 | num, | ||
triU32 | color ) |
Draw a line strip consisting of num points in color 'color'.
p | Array of triVec2's |
num | Number of vertices in line strip |
color | Color of the line strip |
void triDrawRect | ( | triFloat | x, |
triFloat | y, | ||
triFloat | width, | ||
triFloat | height, | ||
triU32 | color ) |
Draw filled rectangle from (x,y) to (x+width,y+height) in color 'color'.
x | X position of rectangles top-left point |
y | Y position of rectangles top-left point |
width | Width of the rectangle |
height | Height of the rectangle |
color | Color of rectangle |
void triDrawRectOutline | ( | triFloat | x, |
triFloat | y, | ||
triFloat | width, | ||
triFloat | height, | ||
triU32 | color ) |
Draw rectangle from (x,y) to (x+width,y+height) in color 'color' with outline only.
x | X position of rectangles top-left point |
y | Y position of rectangles top-left point |
width | Width of the rectangle |
height | Height of the rectangle |
color | Color of rectangle |
void triDrawRectRotate | ( | triFloat | x, |
triFloat | y, | ||
triFloat | width, | ||
triFloat | height, | ||
triU32 | color, | ||
triFloat | angle ) |
Draw Rectangle from (x,y) to (x+width,y+height) in color 'color' rotated by angle degree around it's center.
x | X position of rectangles top-left point |
y | Y position of rectangles top-left point |
width | Width of the rectangle |
height | Height of the rectangle |
color | Color of rectangle |
angle | Number of degree to rotate the rectangle |
void triDrawRectGrad | ( | triFloat | x, |
triFloat | y, | ||
triFloat | width, | ||
triFloat | height, | ||
triU32 | color1, | ||
triU32 | color2, | ||
triU32 | color3, | ||
triU32 | color4 ) |
Draw Rectangle from (x,y) to (x+width,y+height) with gradient.
x | X position of rectangles top-left point |
y | Y position of rectangles top-left point |
width | Width of the rectangle |
height | Height of the rectangle |
color1 | Color of top-left point |
color2 | Color of top-right point |
color3 | Color of bottom-right point |
color4 | Color of bottom-left point |
void triDrawCircle | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radius, | ||
triU32 | color ) |
Draw Circle.
x | X position of circle center |
y | Y position of circle center |
radius | Radius of circle |
color | Color of circle |
void triDrawCircleOutline | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radius, | ||
triU32 | color ) |
Draw Circle (outline only)
x | X position of circle center |
y | Y position of circle center |
radius | Radius of circle |
color | Color of circle |
void triDrawCircleGrad | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radius, | ||
triU32 | color1, | ||
triU32 | color2 ) |
Draw Circle with gradient.
x | X position of circle center |
y | Y position of circle center |
radius | Radius of circle |
color1 | Inner color of circle |
color2 | Outer color of circle |
void triDrawTri | ( | triFloat | x0, |
triFloat | y0, | ||
triFloat | x1, | ||
triFloat | y1, | ||
triFloat | x2, | ||
triFloat | y2, | ||
triU32 | color ) |
Draw arbitrary triangle.
x0 | X position of first point |
y0 | Y position of first point |
x1 | X position of second point |
y1 | Y position of second point |
x2 | X position of third point |
y2 | Y position of third point |
color | Color of triangle |
void triDrawTriOutline | ( | triFloat | x0, |
triFloat | y0, | ||
triFloat | x1, | ||
triFloat | y1, | ||
triFloat | x2, | ||
triFloat | y2, | ||
triU32 | color ) |
Draw arbitrary triangle with outline only.
x0 | X position of first point |
y0 | Y position of first point |
x1 | X position of second point |
y1 | Y position of second point |
x2 | X position of third point |
y2 | Y position of third point |
color | Color of triangle |
void triDrawTriGrad | ( | triFloat | x0, |
triFloat | y0, | ||
triFloat | x1, | ||
triFloat | y1, | ||
triFloat | x2, | ||
triFloat | y2, | ||
triU32 | color1, | ||
triU32 | color2, | ||
triU32 | color3 ) |
Draw arbitrary triangle with outline only.
x0 | X position of first point |
y0 | Y position of first point |
x1 | X position of second point |
y1 | Y position of second point |
x2 | X position of third point |
y2 | Y position of third point |
color1 | Color of first point |
color2 | Color of second point |
color3 | Color of third point |
void triDrawRegPoly | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radius, | ||
triU32 | color, | ||
triU32 | numSteps, | ||
triFloat | angle ) |
Draw regular Polygon (Pentagon,Hexagon,Octagon,etc)
x | X position of polygon center |
y | Y position of polygon center |
radius | Radius of polygon points |
color | Color of polygon |
numSteps | Number of points of polygon (>2) |
angle | Number of degree to rotate the polygon by |
void triDrawRegPolyOutline | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radius, | ||
triU32 | color, | ||
triU32 | numSteps, | ||
triFloat | angle ) |
Draw regular Polygon (Pentagon,Hexagon,Octagon,etc) with outline only.
x | X position of polygon center |
y | Y position of polygon center |
radius | Radius of polygon points |
color | Color of polygon |
numSteps | Number of points of polygon (>2) |
angle | Number of degree to rotate the polygon by |
void triDrawRegPolyGrad | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radius, | ||
triU32 | color1, | ||
triU32 | color2, | ||
triU32 | numSteps, | ||
triFloat | angle ) |
Draw regular Polygon (Pentagon,Hexagon,Octagon,etc) with gradient.
x | X position of polygon center |
y | Y position of polygon center |
radius | Radius of polygon points |
color1 | Color of polygon center |
color2 | Color of polygon outer points |
numSteps | Number of points of polygon (>2) |
angle | Number of degree to rotate the polygon by |
void triDrawStar | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radiusInner, | ||
triFloat | radiusOuter, | ||
triU32 | color, | ||
triU32 | numSteps, | ||
triFloat | angle ) |
Draw Star.
x | X position of star center |
y | Y position of star center |
radiusInner | Radius of inner star points |
radiusOuter | Radius of outer star points |
color | Color of star |
numSteps | Number of points of star (>2) |
angle | Number of degree to rotate the star by |
void triDrawStarOutline | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radiusInner, | ||
triFloat | radiusOuter, | ||
triU32 | color, | ||
triU32 | numSteps, | ||
triFloat | angle ) |
Draw Star with outline only.
x | X position of star center |
y | Y position of star center |
radiusInner | Radius of inner star points |
radiusOuter | Radius of outer star points |
color | Color of star |
numSteps | Number of points of star (>2) |
angle | Number of degree to rotate the star by |
void triDrawStarGrad | ( | triFloat | x, |
triFloat | y, | ||
triFloat | radiusInner, | ||
triFloat | radiusOuter, | ||
triU32 | color1, | ||
triU32 | color2, | ||
triU32 | numSteps, | ||
triFloat | angle ) |
Draw Star with gradient.
x | X position of star center |
y | Y position of star center |
radiusInner | Radius of inner star points |
radiusOuter | Radius of outer star points |
color1 | Color of star center |
color2 | Color of star outer points |
numSteps | Number of points of star (>2) |
angle | Number of degree to rotate the star by |
void triSpriteMode | ( | triFloat | width, |
triFloat | height, | ||
triFloat | angle ) |
Set sprite mode.
width | Width of all subsequent sprites to render |
height | Height of all subsequent sprites to render |
angle | Angle of all subsequent sprites to rotate |
void triDrawSprite | ( | triFloat | x, |
triFloat | y, | ||
triFloat | u, | ||
triFloat | v, | ||
triImage * | img ) |
Render a sprite.
x | Screen position to draw the sprite to |
y | Screen position to draw the sprite to |
u | Vertical sprite position to start drawing from (sprite sheet/tile map) |
v | Horizontal sprite position to start drawing from (sprite sheet/tile map) |
img | Image to draw |
void triBltSprite | ( | triFloat | x, |
triFloat | y, | ||
triFloat | u, | ||
triFloat | v, | ||
triImage * | img ) |
Render a sprite without effects (no blending, transparency, etc.)
x | Screen position to draw the sprite to |
y | Screen position to draw the sprite to |
u | Vertical sprite position to start drawing from (sprite sheet/tile map) |
v | Horizontal sprite position to start drawing from (sprite sheet/tile map) |
img | Image to draw |
void triDrawImageCenterScaled | ( | triFloat | x, |
triFloat | y, | ||
triFloat | scale, | ||
triImage * | img ) |
Render an image centered at position x,y scaled by a factor.
This supports large images > 512x512.
x | Screen position to center the image at |
y | Screen position to center the image at |
scale | Scale factor to scale image with (> 1.0 is zoom in, < 1.0 is zoom out) |
img | Image to draw |
void triDrawImageScaled | ( | triFloat | x, |
triFloat | y, | ||
triFloat | width, | ||
triFloat | height, | ||
triImage * | img ) |
Render an image scaled by a factor.
This supports large images > 512x512.
x | Screen position to draw the image to |
y | Screen position to draw the image to |
width | Width of image on screen for scaling. A width < 0 flips image vertically. |
height | Height of image on screen for scaling. A height < 0 flips image horizontally. |
img | Image to draw |
void triDrawImage2 | ( | triFloat | x, |
triFloat | y, | ||
triImage * | img ) |
Render an image at full size.
This supports large images > 512x512.
x | Screen position to draw the image to |
y | Screen position to draw the image to |
img | Image to draw |
void triDrawImage | ( | triFloat | x, |
triFloat | y, | ||
triFloat | width, | ||
triFloat | height, | ||
triFloat | u0, | ||
triFloat | v0, | ||
triFloat | u1, | ||
triFloat | v1, | ||
triImage * | img ) |
Render an image.
This supports large images > 512x512.
x | Screen position to draw the image to |
y | Screen position to draw the image to |
width | Width of image on screen for scaling. A width < 0 flips image vertically. |
height | Height of image on screen for scaling. A height < 0 flips image horizontally. |
u0 | Vertical image position to start drawing from (sprite sheet/tile map) |
v0 | Horizontal image position to start drawing from (sprite sheet/tile map) |
u1 | Vertical image position to end drawing at (sprite sheet/tile map) |
v1 | Horizontal image position to end drawing at (sprite sheet/tile map) |
img | Image to draw |
void triDrawImageRotate2 | ( | triFloat | x, |
triFloat | y, | ||
triFloat | angle, | ||
triImage * | img ) |
Render an image with rotation.
x | Screen position to draw the image to |
y | Screen position to draw the image to |
angle | Angle to rotate the image by in degree |
img | Image to draw |
void triDrawImageRotate | ( | triFloat | x, |
triFloat | y, | ||
triFloat | width, | ||
triFloat | height, | ||
triFloat | u0, | ||
triFloat | v0, | ||
triFloat | u1, | ||
triFloat | v1, | ||
triFloat | angle, | ||
triImage * | img ) |
Render an image with rotation.
x | Screen position to draw the image to |
y | Screen position to draw the image to |
width | Width of image on screen for scaling |
height | Height of image on screen for scaling |
u0 | Vertical image position to start drawing from (sprite sheet/tile map) |
v0 | Horizontal image position to start drawing from (sprite sheet/tile map) |
u1 | Vertical image position to end drawing at (sprite sheet/tile map) |
v1 | Horizontal image position to end drawing at (sprite sheet/tile map) |
angle | Angle to rotate the image by in degree |
img | Image to draw |
void triDrawImageAnimation | ( | triFloat | x, |
triFloat | y, | ||
triImageAnimation * | ani ) |
Render an image animation.
x | Screen position to draw the image to |
y | Screen position to draw the image to |
ani | Image animation to draw |
void triDrawImageAnimationRotate | ( | triFloat | x, |
triFloat | y, | ||
triFloat | angle, | ||
triImageAnimation * | ani ) |
Render an image animation with rotation.
x | Screen position to draw the image to |
y | Screen position to draw the image to |
angle | Angle to rotate the image by in degree |
ani | Image animation to draw |