CAVElib - Program Structure

Functions:
  • CAVEInitApplication() - one-time graphics callback
  • CAVEFrameFunction() - once-per-frame callback
  • CAVEDisplay() - rendering callback

  • CAVEInit() - start multiprocessing
  • CAVEExit() - end program

Program outline

#include <cave_ogl.h>

void app_init(int argc,char **argv);
void app_compute(void);
void gfx_init(void);
void gfx_draw(void);
     

main(int argc,char **argv)
    {
    CAVEConfigure(&argc,argv,NULL);
    app_init(argc,argv);  
    CAVEInit();  
    CAVEInitApplication(gfx_init,0);  
    CAVEDisplay(gfx_draw,0);       
    while (!CAVEgetbutton(CAVE_ESCKEY))
        app_compute();
    CAVEExit();
    }


void app_init(int argc,char **argv)
    {
    /* ... allocate shared memory & initialize data ... */
    }


void app_compute(void)
    {
    /* ... compute; update shared data ... */
    }


void gfx_init(void)
    {
    /* ... define materials & textures ... */
    }


void gfx_draw(void)
    {
    /* Do NOT set up projection */
    
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    /* ... render ... */
    
    /* Do NOT call SwapBuffers */
    }

Compiling with the CAVElib

The CAVE library files are located in /util/CAVE on the DMS Linux PCs. To compile a CAVE program, you must add pointers to the lib32 & include directories to your Makefile. Add -I/util/CAVE/include to your compile flags (CFLAGS or CPPFLAGS), and -L/util/CAVE/lib32 -lcave_ogl to your link libraries (LIBS).
For example:

CFLAGS = -O -I/home/dms/dave/424/include -I/util/CAVE/include
CPPFLAGS = $(CFLAGS)
LFLAGS = -O
LIBS = -L/home/dms/dave/424/lib -ldms -limage -ltiff \
       -L/util/CAVE/lib32 -lcave_ogl \
       -lglut -lGLU -lGL -L/usr/X11R6/lib -lX11 -lm

cave0: cave0.o
	c++ $(LFLAGS) -o cave0 cave0.o  $(LIBS)



next