Macaw OS C reference

Function gpu_project

#include <macawgpu.h>
int gpu_project(
    double x,
    double y,
    double z,
    double *sx,
    double *sy,
    double *depth
);

Works out where a point in your 3D world lands in the window, with the matrices as they are now. Use it to put a label over a 3D thing.

Parameters

xdouble
The point's x.
ydouble
The point's y.
zdouble
The point's z.
sxdouble *
Pass the address of a double, like &sx, for pixels from the window's left. NULL skips it.
sydouble *
Pass the address of a double for pixels from the window's top. NULL skips it.
depthdouble *
Pass the address of a double for how far away it is, 0 near to 1 far. NULL skips it.

Returns int

1, or 0 if the point is behind the camera (and then nothing is filled in).

In Matrices, with gpu_matrixmode, gpu_loadidentity, gpu_pushmatrix, gpu_popmatrix, gpu_translate, gpu_rotate, gpu_scale, gpu_perspective, gpu_ortho, gpu_frustum, gpu_lookat, gpu_loadmatrix, gpu_multmatrix, gpu_getmatrix.