int main(int argc, char** argv) { int i; char glutGamemode[32]; const char *cparam_name = "Data/camera_para.dat"; #ifdef _WIN32 char *vconf = "Data\\WDM_camera_flipV.xml"; #else char *vconf = ""; #endif char objectDataFilename[] = "Data/object_data_vrml"; // ---------------------------------------------------------------------------- // Library inits. // glutInit(&argc, argv); // ---------------------------------------------------------------------------- // Hardware setup. // if (!setupCamera(cparam_name, vconf, &gARTCparam)) { fprintf(stderr, "main(): Unable to set up AR camera.\n"); exit(-1); } #ifdef _WIN32 CoInitialize(NULL); #endif // ---------------------------------------------------------------------------- // Library setup. // // Set up GL context(s) for OpenGL to draw into. glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); if (!prefWindowed) { if (prefRefresh) sprintf(glutGamemode, "%ix%i:%i@%i", prefWidth, prefHeight, prefDepth, prefRefresh); else sprintf(glutGamemode, "%ix%i:%i", prefWidth, prefHeight, prefDepth); glutGameModeString(glutGamemode); glutEnterGameMode(); } else { glutInitWindowSize(gARTCparam.xsize, gARTCparam.ysize); glutCreateWindow(argv[0]); } // Setup argl library for current context. if ((gArglSettings = arglSetupForCurrentContext()) == NULL) { fprintf(stderr, "main(): arglSetupForCurrentContext() returned error.\n"); exit(-1); } debugReportMode(); arUtilTimerReset(); if (!setupMarkersObjects(objectDataFilename)) { fprintf(stderr, "main(): Unable to set up AR objects and markers.\n"); Quit(); } // Test render all the VRML objects. fprintf(stdout, "Pre-rendering the VRML objects..."); fflush(stdout); glEnable(GL_TEXTURE_2D); for (i = 0; i < gObjectDataCount; i++) { arVrmlDraw(gObjectData[i].vrml_id); } glDisable(GL_TEXTURE_2D); fprintf(stdout, " done\n"); // Register GLUT event-handling callbacks. // NB: Idle() is registered by Visibility. glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutVisibilityFunc(Visibility); glutKeyboardFunc(Keyboard); glutMainLoop(); return (0); }
int main(int argc, char** argv) { int i; char glutGamemode[32]; char cparam_name[] = "Data/camera_para.dat"; char vconf[] = ""; char objectDataFilename[] = "Data/object_data_vrml"; // // Library inits. // glutInit(&argc, argv); // // Video setup. // if (!setupCamera(cparam_name, vconf, &gCparamLT, &gARHandle, &gAR3DHandle)) { ARLOGe("main(): Unable to set up AR camera.\n"); exit(-1); } #ifdef _WIN32 CoInitialize(NULL); #endif // // Graphics setup. // // Set up GL context(s) for OpenGL to draw into. glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); if (!windowed) { if (windowRefresh) sprintf(glutGamemode, "%ix%i:%i@%i", windowWidth, windowHeight, windowDepth, windowRefresh); else sprintf(glutGamemode, "%ix%i:%i", windowWidth, windowHeight, windowDepth); glutGameModeString(glutGamemode); glutEnterGameMode(); } else { glutInitWindowSize(windowWidth, windowHeight); glutCreateWindow(argv[0]); } // Setup ARgsub_lite library for current OpenGL context. if ((gArglSettings = arglSetupForCurrentContext(&(gCparamLT->param), arVideoGetPixelFormat())) == NULL) { ARLOGe("main(): arglSetupForCurrentContext() returned error.\n"); cleanup(); exit(-1); } arglSetupDebugMode(gArglSettings, gARHandle); arUtilTimerReset(); if (!setupMarkersObjects(objectDataFilename, &gObjectData, &gObjectDataCount, gARHandle)) { ARLOGe("main(): Unable to set up AR objects and markers.\n"); cleanup(); exit(-1); } // Test render all the VRML objects. ARLOGi("Pre-rendering the VRML objects...\n"); glEnable(GL_TEXTURE_2D); for (i = 0; i < gObjectDataCount; i++) { arVrmlDraw(gObjectData[i].vrml_id); } glDisable(GL_TEXTURE_2D); ARLOGi(" done\n"); // Register GLUT event-handling callbacks. // NB: mainLoop() is registered by Visibility. glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutVisibilityFunc(Visibility); glutKeyboardFunc(Keyboard); glutMainLoop(); return (0); }