The basic form of a Performer/CAVELib program is as follows:
#include <Performer/pf/pfChannel.h>
#include <pfcave.h>
void create_scene(pfChannel *chan);
int
main(int argc,char **argv) {
/* Initialize Performer */
pfInit();
/* Equivalent to CAVE Config. Must be called after pfInit() */
pfCAVEConfig(&argc,argv,NULL);
/* Performer config */
pfConfig();
/* Creates all the channels for performer */
pfCAVEInitChannels();
/* create a blank scene, add it to the master channel */
create_scene(pfCAVEMasterChan());
while (!CAVEgetbutton(CAVE_ESCKEY)) {
/* Required by performer to synch things to a
certain frame rate. */
pfSync();
/* Updates tracker data and sets up new projects for
each channel. */
pfCAVEPreFrame();
/* Required by performer to trigger cull and draw */
pfFrame();
/* Updates non latency critical data. */
pfCAVEPostFrame();
}
pfCAVEHalt();
pfExit();
return 0;
}
void create_scene(pfChannel *chan)
{
/* create a pf scene */
pfScene *scene = new pfScene;
/* Add scene to master channel */
chan->setScene(scene);
}
These function calls must be added to a Performer program in order to use the pfCAVELib:
pfCAVEConfig(argc,argv,NULL) The equivalent of CAVEConfig(). This must be called after pfInit() and before pfConfig().
pfCAVEInitChannels() Creates all the channels, and makes them a single channel group. This must be called after pfConfig().
pfCAVEPreFrame() Updates the tracker data and sets up new projections for each channel. Should be called once per frame before pfFrame().
pfCAVEPostFrame() Updates non-latency-critical data. Should be called once per frame after pfFrame().
The header file (pfcave.h) is in CAVE/include; the library binaries (libpfcave_ogl.a, libpfcave_ogl_mips3.a) are in CAVE/lib32 and CAVE/lib64 directories.