[artoolkit-commits] artoolkit/examples/twoView twoView.c,1.11,1.12
Optical marker tracking and overlay for augmented reality.
Brought to you by:
philip_lamb
From: Philip L. <phi...@us...> - 2006-04-06 05:33:53
|
Update of /cvsroot/artoolkit/artoolkit/examples/twoView In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4111 Modified Files: twoView.c Log Message: Moved some gsub_lite globals into state structure. Index: twoView.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/twoView/twoView.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** twoView.c 22 Sep 2005 19:35:40 -0000 1.11 --- twoView.c 6 Apr 2006 05:33:48 -0000 1.12 *************** *** 244,250 **** // Report state of ARToolKit global variables arFittingMode, // arImageProcMode, arglDrawMode, arTemplateMatchingMode, arMatchingPCAMode. ! static void demoARDebugReportMode(void) { ! if(arFittingMode == AR_FITTING_TO_INPUT ) { fprintf(stderr, "FittingMode (Z): INPUT IMAGE\n"); } else { --- 244,250 ---- // Report state of ARToolKit global variables arFittingMode, // arImageProcMode, arglDrawMode, arTemplateMatchingMode, arMatchingPCAMode. ! static void demoARDebugReportMode(ARGL_CONTEXT_SETTINGS_REF arglSettings) { ! if (arFittingMode == AR_FITTING_TO_INPUT) { fprintf(stderr, "FittingMode (Z): INPUT IMAGE\n"); } else { *************** *** 252,256 **** } ! if( arImageProcMode == AR_IMAGE_PROC_IN_FULL ) { fprintf(stderr, "ProcMode (X) : FULL IMAGE\n"); } else { --- 252,256 ---- } ! if (arImageProcMode == AR_IMAGE_PROC_IN_FULL) { fprintf(stderr, "ProcMode (X) : FULL IMAGE\n"); } else { *************** *** 258,264 **** } ! if( arglDrawMode == AR_DRAW_BY_GL_DRAW_PIXELS ) { fprintf(stderr, "DrawMode (C) : GL_DRAW_PIXELS\n"); ! } else if( arglTexmapMode == AR_DRAW_TEXTURE_FULL_IMAGE ) { fprintf(stderr, "DrawMode (C) : TEXTURE MAPPING (FULL RESOLUTION)\n"); } else { --- 258,264 ---- } ! if (arglDrawModeGet(arglSettings) == AR_DRAW_BY_GL_DRAW_PIXELS) { fprintf(stderr, "DrawMode (C) : GL_DRAW_PIXELS\n"); ! } else if (arglTexmapModeGet(arglSettings) == AR_DRAW_TEXTURE_FULL_IMAGE) { fprintf(stderr, "DrawMode (C) : TEXTURE MAPPING (FULL RESOLUTION)\n"); } else { *************** *** 266,270 **** } ! if( arTemplateMatchingMode == AR_TEMPLATE_MATCHING_COLOR ) { fprintf(stderr, "TemplateMatchingMode (M) : Color Template\n"); } else { --- 266,270 ---- } ! if (arTemplateMatchingMode == AR_TEMPLATE_MATCHING_COLOR) { fprintf(stderr, "TemplateMatchingMode (M) : Color Template\n"); } else { *************** *** 272,276 **** } ! if( arMatchingPCAMode == AR_MATCHING_WITHOUT_PCA ) { fprintf(stderr, "MatchingPCAMode (P) : Without PCA\n"); } else { --- 272,276 ---- } ! if (arMatchingPCAMode == AR_MATCHING_WITHOUT_PCA) { fprintf(stderr, "MatchingPCAMode (P) : Without PCA\n"); } else { *************** *** 329,332 **** --- 329,333 ---- { int i; + int mode; switch (key) { *************** *** 341,367 **** case 'C': case 'c': - if( arglDrawMode == AR_DRAW_BY_GL_DRAW_PIXELS ) { - arglDrawMode = AR_DRAW_BY_TEXTURE_MAPPING; - arglTexmapMode = AR_DRAW_TEXTURE_FULL_IMAGE; - } else if( arglTexmapMode == AR_DRAW_TEXTURE_FULL_IMAGE ) { - arglTexmapMode = AR_DRAW_TEXTURE_HALF_IMAGE; - } else { - arglDrawMode = AR_DRAW_BY_GL_DRAW_PIXELS; - } for (i = 0; i < gContextsActiveCount; i++) { fprintf(stderr, "*** Camera %2d - %f (frame/sec)\n", i + 1, (double)(gContextsActive[i].callCountMarkerDetect)/arUtilTimer()); gContextsActive[i].callCountMarkerDetect = 0; } arUtilTimerReset(); gCallCountGetImage = 0; - demoARDebugReportMode(); break; - #ifdef AR_OPENGL_TEXTURE_RECTANGLE - case 'R': - case 'r': - arglTexRectangle = !arglTexRectangle; - fprintf(stderr, "Toggled arglTexRectangle to %d.\n", arglTexRectangle); - break; - #endif // AR_OPENGL_TEXTURE_RECTANGLE case '?': case '/': --- 342,362 ---- case 'C': case 'c': for (i = 0; i < gContextsActiveCount; i++) { + mode = arglDrawModeGet(gContextsActive[i].arglSettings); + if (mode == AR_DRAW_BY_GL_DRAW_PIXELS) { + arglDrawModeSet(gContextsActive[i].arglSettings, AR_DRAW_BY_TEXTURE_MAPPING); + arglTexmapModeSet(gContextsActive[i].arglSettings, AR_DRAW_TEXTURE_FULL_IMAGE); + } else { + mode = arglTexmapModeGet(gContextsActive[i].arglSettings); + if (mode == AR_DRAW_TEXTURE_FULL_IMAGE) arglTexmapModeSet(gContextsActive[i].arglSettings, AR_DRAW_TEXTURE_HALF_IMAGE); + else arglDrawModeSet(gContextsActive[i].arglSettings, AR_DRAW_BY_GL_DRAW_PIXELS); + } fprintf(stderr, "*** Camera %2d - %f (frame/sec)\n", i + 1, (double)(gContextsActive[i].callCountMarkerDetect)/arUtilTimer()); gContextsActive[i].callCountMarkerDetect = 0; + demoARDebugReportMode(gContextsActive[i].arglSettings); } arUtilTimerReset(); gCallCountGetImage = 0; break; case '?': case '/': *************** *** 369,375 **** printf(" q or [esc] Quit demo.\n"); printf(" c Change arglDrawMode and arglTexmapMode.\n"); - #ifdef AR_OPENGL_TEXTURE_RECTANGLE - printf(" r Toggle arglTexRectangle.\n"); - #endif // AR_OPENGL_TEXTURE_RECTANGLE printf(" ? or / Show this help.\n"); printf("\nAdditionally, the ARVideo library supplied the following help text:\n"); --- 364,367 ---- *************** *** 593,597 **** } gContextsActiveCount = CONTEXTSACTIVECOUNT; ! demoARDebugReportMode(); if (!demoARSetupMarker(patt_name, &gPatt_id)) { fprintf(stderr, "main(): Unable to set up AR marker.\n"); --- 585,589 ---- } gContextsActiveCount = CONTEXTSACTIVECOUNT; ! for (i = 0; i < gContextsActiveCount; i++) demoARDebugReportMode(gContextsActive[i].arglSettings); if (!demoARSetupMarker(patt_name, &gPatt_id)) { fprintf(stderr, "main(): Unable to set up AR marker.\n"); |