static void dispImage(void) { AR2VideoBufferT *buff; double x, y; int ssx, eex, ssy, eey; int i; if( status == 0 ) { while (!(buff = arVideoGetImage()) || !buff->fillFlag) arUtilSleep(2); argDrawMode2D( vp ); argDrawImage(buff->buff); } else if( status == 1 ) { argDrawMode2D( vp ); argDrawImage( patt.savedImage[patt.loop_num-1] ); for( i = 0; i < point_num; i++ ) { x = patt.point[patt.loop_num-1][i].x_coord; y = patt.point[patt.loop_num-1][i].y_coord; glColor3f( 1.0f, 0.0f, 0.0f ); argDrawLineByObservedPos( x-10, y, x+10, y ); argDrawLineByObservedPos( x, y-10, x, y+10 ); } if( sx != -1 && sy != -1 ) { if( sx < ex ) { ssx = sx; eex = ex; } else { ssx = ex; eex = sx; } if( sy < ey ) { ssy = sy; eey = ey; } else { ssy = ey; eey = sy; } dispClipImage( ssx, ssy, eex-ssx+1, eey-ssy+1, clipImage ); } } else if( status == 2 ) { argDrawMode2D( vp ); argDrawImage( patt.savedImage[check_num] ); for( i = 0; i < patt.h_num*patt.v_num; i++ ) { x = patt.point[check_num][i].x_coord; y = patt.point[check_num][i].y_coord; glColor3f( 1.0f, 0.0f, 0.0f ); argDrawLineByObservedPos( x-10, y, x+10, y ); argDrawLineByObservedPos( x, y-10, x, y+10 ); } draw_line(); } argSwapBuffers(); }
static void dispImage(void) { unsigned char *dataPtr; double x, y; int ssx, eex, ssy, eey; int i; if( status == 0 ) { if( (dataPtr = (unsigned char *)arVideoGetImage()) == NULL ) { arUtilSleep(2); return; } dispImage2( dataPtr ); arVideoCapNext(); } else if( status == 1 ) { dispImage2( patt.savedImage[patt.loop_num-1] ); for( i = 0; i < point_num; i++ ) { x = patt.point[patt.loop_num-1][i].x_coord; y = patt.point[patt.loop_num-1][i].y_coord; glColor3f( 1.0, 0.0, 0.0 ); glBegin(GL_LINES); glVertex2f( x-10, (ysize-1)-y ); glVertex2f( x+10, (ysize-1)-y ); glVertex2f( x, (ysize-1)-(y-10) ); glVertex2f( x, (ysize-1)-(y+10) ); glEnd(); } if( sx != -1 && sy != -1 ) { if( sx < ex ) { ssx = sx; eex = ex; } else { ssx = ex; eex = sx; } if( sy < ey ) { ssy = sy; eey = ey; } else { ssy = ey; eey = sy; } dispClipImage( ssx, ysize-1-ssy, eex-ssx+1, eey-ssy+1, clipImage ); #if 0 glColor3f( 0.0, 0.0, 1.0 ); glBegin(GL_LINE_LOOP); glVertex2f( sx, (ysize-1)-sy ); glVertex2f( ex, (ysize-1)-sy ); glVertex2f( ex, (ysize-1)-ey ); glVertex2f( sx, (ysize-1)-ey ); glEnd(); #endif } } else if( status == 2 ) { dispImage2( patt.savedImage[check_num] ); for( i = 0; i < patt.h_num*patt.v_num; i++ ) { x = patt.point[check_num][i].x_coord; y = patt.point[check_num][i].y_coord; glColor3f( 1.0, 0.0, 0.0 ); glBegin(GL_LINES); glVertex2f( x-10, (ysize-1)-y ); glVertex2f( x+10, (ysize-1)-y ); glVertex2f( x, (ysize-1)-(y-10) ); glVertex2f( x, (ysize-1)-(y+10) ); glEnd(); } draw_line(); } glutSwapBuffers(); }