A Program Skeleton
/* simple.c
/* A trivial CAVE demo program, demonstrating the most basic CAVE library
/* functions. This program just draws a red triangle in the front of the
/* CAVE. No interaction (outside of moving around), and nothing changes.
*/
#include
void simple_draw(void);
main(int argc,char **argv)
{
/* Initialize the CAVE */
CAVEConfigure(&argc,argv,NULL);
CAVEInit();
/* Give the library a pointer to the drawing function */
CAVEDisplay(simple_draw,0);
/* Wait for the escape key to be hit */
while (!getbutton(ESCKEY))
sginap(10);
/* Clean up & exit */
CAVEExit();
}
/* simple_draw - the display function. This function is called by the
CAVE library in the rendering processes' display loop. It draws a red
triangle 2 feet tall, 4 feet off the floor, and 1 foot in front of the
front wall (assuming a 10' CAVE). */
void simple_draw(void)
{
float vert1[3] = { -1, 4, -4},
vert2[3] = { 1, 4, -4},
vert3[3] = { 0, 6, -4};
cpack(0); clear(); zclear();
cpack(0xff);
bgnline();
v3f(vert1);
v3f(vert2);
v3f(vert3);
v3f(vert1);
endline();
}