Macaw OS C reference

The graphics chip

#include <macawgpu.h>

#include <macawgpu.h> to talk to the 3D hardware from C. Call these from your program's _draw function: they draw into the window (or into the picture drawinto picked), and they work the way old OpenGL 1.x does. They're Lua's gpu.* calls with gpu_ in front, so The graphics chip has the ideas and examples, and C says how C programs work.

Modules

State
gpu_enable, gpu_disable, gpu_isenabled, gpu_depthmask, gpu_cullface, gpu_frontface and more
Matrices
A matrix is a grid of 16 numbers that moves, turns, grows or projects every corner you draw.
Drawing a corner at a time
gpu_begin, gpu_color, gpu_colorex, gpu_texcoord, gpu_normal, gpu_vertex and more
Buffers
A buffer keeps a model's corners, so you send them once and draw them each frame.
Textures, light and fog
gpu_bindtexture, gpu_light, gpu_lightoff, gpu_ambient, gpu_shademodel, gpu_material and more
Reflecting water
To draw water that reflects: draw the scene into a picture from a camera mirrored in the water, draw the main scene, call gpu_mask(1), draw the water's surface, call gpu_mask(0), then call gpu_water.
Baked reflections
A cube map is six views from one place, drawn once, that water can reflect instead of a picture drawn again every frame.