[artoolkit-commits] artoolkit/examples/simpleLite simpleLite.c,1.6,1.7
Optical marker tracking and overlay for augmented reality.
Brought to you by:
philip_lamb
From: Philip L. <phi...@us...> - 2005-07-29 23:23:18
|
Update of /cvsroot/artoolkit/artoolkit/examples/simpleLite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23918 Modified Files: simpleLite.c Log Message: Cleanup drawing code. Index: simpleLite.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/simpleLite/simpleLite.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** simpleLite.c 28 Jul 2005 20:30:13 -0000 1.6 --- simpleLite.c 29 Jul 2005 23:23:08 -0000 1.7 *************** *** 8,12 **** * Press '?' while running for help on available key commands. * ! * Copyright (c) 2001-2004 Philip Lamb (PRL) ph...@ed.... All rights reserved. * * Rev Date Who Changes --- 8,12 ---- * Press '?' while running for help on available key commands. * ! * Copyright (c) 2001-2005 Philip Lamb (PRL) ph...@ed.... All rights reserved. * * Rev Date Who Changes *************** *** 73,88 **** // ARToolKit globals. - static long gCallCountMarkerDetect = 0; - static int gARTThreshhold = 100; - static int gPatt_id; - static double gPatt_width = 80.0; - static double gPatt_centre[2] = {0.0, 0.0}; - static ARParam gARTCparam; static ARUint8 *gARTImage = NULL; static double gPatt_trans[3][4]; ! static int gPatt_found; static ARGL_CONTEXT_SETTINGS_REF gArglSettings = NULL; // Other globals. static int gDrawRotate = FALSE; --- 73,88 ---- // ARToolKit globals. static ARParam gARTCparam; static ARUint8 *gARTImage = NULL; + static int gARTThreshhold = 100; + static long gCallCountMarkerDetect = 0; static double gPatt_trans[3][4]; ! static int gPatt_found = FALSE; static ARGL_CONTEXT_SETTINGS_REF gArglSettings = NULL; + static int gPatt_id; + static double gPatt_width = 80.0; + static double gPatt_centre[2] = {0.0, 0.0}; + // Other globals. static int gDrawRotate = FALSE; *************** *** 148,152 **** // Sets up gARTCparam. ! static int demoARSetupCamera(const unsigned char *cparam_name, char *vconf) { ARParam wparam; --- 148,152 ---- // Sets up gARTCparam. ! static int demoARSetupCamera(const char *cparam_name, char *vconf) { ARParam wparam; *************** *** 181,185 **** } ! static int demoARSetupMarker(const unsigned char *patt_name, int *patt_id) { --- 181,185 ---- } ! static int demoARSetupMarker(const char *patt_name, int *patt_id) { *************** *** 229,232 **** --- 229,240 ---- } + static void Quit(void) + { + arglCleanup(gArglSettings); + arVideoCapStop(); + arVideoClose(); + exit(0); + } + static void Keyboard(unsigned char key, int x, int y) { *************** *** 235,242 **** case 'Q': case 'q': ! arglCleanup(gArglSettings); ! arVideoCapStop(); ! arVideoClose(); ! exit(0); break; case ' ': --- 243,247 ---- case 'Q': case 'q': ! Quit(); break; case ' ': *************** *** 258,262 **** demoARDebugReportMode(); break; - break; #ifdef AR_OPENGL_TEXTURE_RECTANGLE case 'R': --- 263,266 ---- *************** *** 289,293 **** float s_elapsed; ARUint8 *image; ! ARMarkerInfo *marker_info; // Pointer to array holding the details of detected markers. int marker_num; // Count of number of markers detected. --- 293,297 ---- float s_elapsed; ARUint8 *image; ! ARMarkerInfo *marker_info; // Pointer to array holding the details of detected markers. int marker_num; // Count of number of markers detected. *************** *** 305,309 **** // Grab a video frame. if ((image = arVideoGetImage()) != NULL) { ! gARTImage = image; gCallCountMarkerDetect++; // Increment ARToolKit FPS counter. --- 309,314 ---- // Grab a video frame. if ((image = arVideoGetImage()) != NULL) { ! gARTImage = image; // Save the fetched image. ! gPatt_found = FALSE; // Invalidate any previous detected markers. gCallCountMarkerDetect++; // Increment ARToolKit FPS counter. *************** *** 332,336 **** // Tell GLUT the display has changed. glutPostRedisplay(); ! } } --- 337,341 ---- // Tell GLUT the display has changed. glutPostRedisplay(); ! } } *************** *** 370,380 **** static void Display(void) { ! static GLdouble *p = NULL; ! GLdouble m[16]; ! // Context setup. glDrawBuffer(GL_BACK); arglDispImage(gARTImage, &gARTCparam, 1.0, gArglSettings); // zoom = 1.0. - arVideoCapNext(); --- 375,385 ---- static void Display(void) { ! GLdouble p[16]; ! GLdouble m[16]; ! // Select correct buffer for this context. glDrawBuffer(GL_BACK); + arglDispImage(gARTImage, &gARTCparam, 1.0, gArglSettings); // zoom = 1.0. arVideoCapNext(); *************** *** 383,390 **** // Projection transformation. ! if (p == NULL) { ! p = (GLdouble *)malloc(16 * (sizeof(GLdouble))); ! arglCameraFrustum(&gARTCparam, VIEW_DISTANCE_MIN, VIEW_DISTANCE_MAX, p); ! } glMatrixMode(GL_PROJECTION); glLoadMatrixd(p); --- 388,392 ---- // Projection transformation. ! arglCameraFrustum(&gARTCparam, VIEW_DISTANCE_MIN, VIEW_DISTANCE_MAX, p); glMatrixMode(GL_PROJECTION); glLoadMatrixd(p); *************** *** 397,401 **** //none ! // ARToolKit supplied distance in millimetres, but I want OpenGL to work in metres. arglCameraView(gPatt_trans, m, VIEW_SCALEFACTOR); glLoadMatrixd(m); --- 399,403 ---- //none ! // ARToolKit supplied distance in millimetres, but I want OpenGL to work in my units. arglCameraView(gPatt_trans, m, VIEW_SCALEFACTOR); glLoadMatrixd(m); *************** *** 403,408 **** // All other lighting and geometry goes here. DrawCube(); - - gPatt_found = FALSE; } // gPatt_found --- 405,408 ---- *************** *** 416,420 **** { char glutGamemode[32]; ! const unsigned char *cparam_name = "Data/camera_para.dat"; char *vconf = // Camera configuration. --- 416,420 ---- { char glutGamemode[32]; ! const char *cparam_name = "Data/camera_para.dat"; char *vconf = // Camera configuration. *************** *** 426,430 **** "-dev=/dev/video0 -channel=0 -palette=YUV420P -width=320 -height=240"; #endif ! const unsigned char *patt_name = "Data/patt.hiro"; // ---------------------------------------------------------------------------- --- 426,430 ---- "-dev=/dev/video0 -channel=0 -palette=YUV420P -width=320 -height=240"; #endif ! const char *patt_name = "Data/patt.hiro"; // ---------------------------------------------------------------------------- |