void vrlib_init (void) { vrStart (); vrFunctionSetCallback (VRFUNC_DISPLAY_INIT, vrCallbackCreate (vrlib_init_GL, 0)); vrFunctionSetCallback (VRFUNC_DISPLAY_FRAME, vrCallbackCreate (vrlib_frame, 0)); vrFunctionSetCallback (VRFUNC_DISPLAY, vrCallbackCreate (vrlib_display, 0)); return; }
int main(int argc, char* argv[]) { char buffer[2048]; /* string buffer for self-control list */ signal(SIGINT, SIG_IGN); vrConfigure(&argc, argv, NULL); vrStart(); signal(SIGINT, exit_application); /* TODO: it would be nice to put these above vrStart(), since */ /* it will block until all input devices are open, and this */ /* way we could be rendering something while waiting. */ /* TODO: actually, we almost *need* to have the init_gfx stuff*/ /* set before vrStart, so the window opening function will */ /* have something to call (other than vrDoNothing()). */ /* In fact, I have no idea how init_gfx() gets called at */ /* all given the current setup. */ vrFunctionSetCallback(VRFUNC_ALL_DISPLAY_INIT, vrCallbackCreate(init_gfx, 0)); vrFunctionSetCallback(VRFUNC_ALL_DISPLAY, vrCallbackCreate(draw_server_world, 0)); vrFunctionSetCallback(VRFUNC_HANDLE_USR2, vrCallbackCreate(vrDbgInfo, 0)); if (vrContext->input->num_input_devices > 0) { vrDbgPrintfN(SELDOM_DBGLVL+1, "input viewer: input device[0] version = '%s'\n", vrContext->input->input_devices[0]->version); } else { vrDbgPrintfN(SELDOM_DBGLVL+1, "input viewer: No input devices defined.\n"); } vrSystemSetName("inputs -- FreeVR inputs display application"); vrSystemSetAuthors("Bill Sherman"); list_self_controls(buffer, vrContext->input, sizeof(buffer), verbose); vrPrintf(buffer); vrSystemSetExtraInfo(buffer); vrDbgPrintf("input viewer: looping\n"); while(vrFrame()) { update_world(); } exit_application(); exit(0); }