static void init( void ) { /* Josh */ ARParam wparam; xsize = 1024; //my size of picture ysize = 1024; //dp = opendir ("./"); dp = opendir (directory); // devil ilInit(); iluInit(); if (dp == NULL) { printf("Image directory could not be opened !!\n"); exit(0); } // get first image for size, then reload directory GetNextImage(); dp = opendir (directory); // if over size limit (or possibly not detected) if ((xsize >= 1024) || (ysize >= 1024) || (xsize == FALSE) || (ysize == FALSE)) { printf("Image size invalid - too big or broken !!\n"); exit(0); } /* Josh */ arParamChangeSize( &wparam, xsize, ysize, &cparam ); //arVideoInqSize(&xsize, &ysize); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); if( (patt_id=arLoadPatt(patt_name)) < 0 ) { printf("pattern load error !!\n"); exit(0); } /* open the graphics window */ argInit( &cparam, 1.0, 0, 0, 0, 0 ); }
int main(int argc, char *argv[]) { ARParam cparam; // ARParamLT *cparamLT; float trans[3][4]; float pos[2]; float dpi[2]; // char name[1024], ext[1024]; int i, j; float z; init(argc, argv); if (!cpara) cpara = cparaDefault; // ar2UtilDivideExt( cpara, name, ext ); // Load the camera parameters, resize for the window and init. // if( arParamLoad(name, ext, 1, &cparam) < 0 ) if (arParamLoad(cpara, 1, &cparam) < 0) { ARLOGe("setupCamera(): Error loading parameter file %s for camera.\n", cpara); exit(-1); } if (xsize != -1 && ysize != -1 && (cparam.xsize != xsize || cparam.ysize != ysize)) { ARLOG("*** Camera Parameter resized from %d, %d. ***\n", cparam.xsize, cparam.ysize); arParamChangeSize(&cparam, xsize, ysize, &cparam); } ARLOG("*** Camera Parameter ***\n"); arParamDisp(&cparam); // if ((cparamLT = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) { // ARLOGe("setupCamera(): Error: arParamLTCreate.\n"); // exit(-1); // } pos[0] = 0.0; pos[1] = 0.0; for (j = 0; j < 3; j++) for (i = 0; i < 4; i++) trans[j][i] = ((i == j) ? 1.0 : 0.0); for (i = 10; i <= 1000; i *= 10) { for (j = 1; j < 10; j++) { z = j * i; trans[2][3] = z; ar2GetResolution2(&cparam, trans, pos, dpi); ARLOG("Distance: %f [mm] --> Resolution = %10.5f, %10.5f [DPI]\n", z, dpi[0], dpi[1]); } } return (0); }
static void init( void ) { ARParam wparam; int i; /* open the video path */ if( arVideoOpen( vconf ) < 0 ) exit(0); /* find the size of the window */ if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); for( i=0; i < PTT_NUM; i++){ if( (object[i].patt_id = arLoadPatt(object[i].patt_name)) < 0 ) { printf("パターン読み込みに失敗しました!! %s\n", object[i].patt_name); exit(0); } } /* open the graphics window */ argInit( &cparam, 1.0, 0, 0, 0, 0 ); }
static int setupCamera(const char *cparam_name, char *vconf, ARParam *cparam) { ARParam wparam; int xsize, ysize; // Open the video path. if (arVideoOpen(vconf) < 0) { fprintf(stderr, "setupCamera(): Unable to open connection to camera.\n"); return (FALSE); } // Find the size of the window. if (arVideoInqSize(&xsize, &ysize) < 0) return (FALSE); fprintf(stdout, "Camera image size (x,y) = (%d,%d)\n", xsize, ysize); // Load the camera parameters, resize for the window and init. if (arParamLoad(cparam_name, 1, &wparam) < 0) { fprintf(stderr, "setupCamera(): Error loading parameter file %s for camera.\n", cparam_name); return (FALSE); } arParamChangeSize(&wparam, xsize, ysize, cparam); fprintf(stdout, "*** Camera Parameter ***\n"); arParamDisp(cparam); arInitCparam(cparam); if (arVideoCapStart() != 0) { fprintf(stderr, "setupCamera(): Unable to begin camera data capture.\n"); return (FALSE); } return (TRUE); }
static void init() { ARParam wparam; //Open video path, vconf is default camera config if (arVideoOpen(vconf) < 0) { exit(0); } //Get size of window if (arVideoInqSize(&xsize, &ysize) < 0) { exit(0); } //Set camera paramaters if (arParamLoad(cparam_name, 1, &wparam) < 0) { printf("Couldn't load camera parameters"); exit(0); } arParamChangeSize(&wparam, xsize, ysize, &cparam); arInitCparam(&cparam); //Load pattern if ((patt_id = arLoadPatt(patt_name)) < 0) { printf("Failed to load pattern"); exit(0); } //Open graphics window argInit(&cparam, 1, 0, 0, 0, 0); }
static void init( void ) { ARParam wparam; /* open the video path */ if( arVideoOpen( vconf ) < 0 ) exit(0); /* find the size of the window */ if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); if( (config = arMultiReadConfigFile(config_name)) == NULL ) { printf("config data load error !!\n"); exit(0); } /* open the graphics window */ argInit( &cparam, 1.0, 0, 2, 1, 0 ); arFittingMode = AR_FITTING_TO_IDEAL; arImageProcMode = AR_IMAGE_PROC_IN_HALF; argDrawMode = AR_DRAW_BY_TEXTURE_MAPPING; argTexmapMode = AR_DRAW_TEXTURE_HALF_IMAGE; }
/* set up the application parameters - read in from command line*/ static int init( int argc, char *argv[] ) { ARParam wparam; /* open the video path */ printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(CPARA, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); /* open the graphics window */ argInit( &cparam, 1.0, 0, 2, 1, 0 ); arFittingMode = AR_FITTING_TO_IDEAL; arImageProcMode = AR_IMAGE_PROC_IN_HALF; argDrawMode = AR_DRAW_BY_TEXTURE_MAPPING; argTexmapMode = AR_DRAW_TEXTURE_FULL_IMAGE; gen_image( imgMode ); dispMode(); return 0; }
static void init( void ) { ARParam wparam; /* open the video path */ if( arVideoOpen( vconf ) < 0 ) exit(0); /* find the size of the window */ if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); /* load in the object data - trained markers and associated bitmap files */ if( (object=read_ObjData(model_name, &objectnum)) == NULL ) exit(0); printf("Objectfile num = %d\n", objectnum); /* open the graphics window */ argInit( &cparam, 2.0, 0, 0, 0, 0 ); }
static void init( void ) { ARParam wparam; char name1[256], name2[256]; printf("Enter camera parameter filename"); printf("(Data/camera_para.dat): "); if( fgets(name1, 256, stdin) == NULL ) exit(0); if( sscanf(name1, "%s", name2) != 1 ) { strcpy( name2, "Data/camera_para.dat"); } if( arParamLoad(name2, 1, &wparam) < 0 ) { printf("Parameter load error !!\n"); exit(0); } if( arVideoOpen(vconf) < 0 ) exit(0); if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0); arMalloc( image, ARUint8, xsize*ysize*AR_PIX_SIZE ); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); arParamChangeSize( &wparam, xsize, ysize, ¶m ); arParamDisp( ¶m ); arInitCparam( ¶m ); argInit( ¶m, 1.0, 0, 0, 0, 0 ); argDrawMode2D(); }
static void init( void ) { ARParam wparam; /* open the video path */ if( knVideoOpen( vconf ) < 0 ) exit(0); /* find the size of the window */ if( knVideoInqSize(&xsize, &ysize) < 0 ) exit(0); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); if( (patt_id=arLoadPatt(patt_name)) < 0 ) { printf("pattern load error !!\n"); exit(0); } /* open the graphics window */ argInit( &cparam, 1.0, 0, 0, 0, 0 ); }
//======================================================= // 初期化関数 //======================================================= void Init(void) { ARParam wparam; // カメラパラメータ // ビデオデバイスの設定 if( arVideoOpen( vconf_name ) < 0 ){ printf("ビデオデバイスのエラー\n"); exit(0); } // ウィンドウサイズの取得 if( arVideoInqSize( &xsize, &ysize ) < 0 ) exit(0); printf("Image size (x,y) = (%d,$d)\n", xsize, ysize); // カメラパラメータの設定 if( arParamLoad( cparam_name, 1, &wparam ) < 0 ){ printf("カメラパラメータの読み込みに失敗しました\n"); exit(0); } // カメラパラメータのサイズ調整 arParamChangeSize( &wparam, xsize, ysize, &cparam ); // カメラパラメータの初期化 arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); // パターンファイルのロード for( int i=0; i<MARK_NUM; i++ ){ if( (marker[i].patt_id = arLoadPatt(marker[i].patt_name)) < 0){ printf("パターンファイルの読み込みに失敗しました\n"); printf("%s\n", marker[i].patt_name); exit(0); } } // gsubライブラリの初期化 argInit( &cparam, 1.0, 0, 0, 0, 0 ); mqoInit(); //メタセコイアの初期化 // モデルの読み込み for(int i=0;i<8;i++){ if ( (model[i] = mqoCreateModel( mqo_name[i], 1.0 )) == NULL ) { printf("モデルの読み込みに失敗しました\n"); // return -1; } } if ( (rmodel = mqoCreateModel( mqo_rnm, 1.0 )) == NULL ) { printf("モデルの読み込みに失敗しました\n"); // return -1; } // ウィンドウタイトルの設定 glutSetWindowTitle("PaperPiano"); }
/* * Class: net_towerdefender_image_ARToolkit * Method: artoolkit_init * Signature: (Ljava/lang/String;IIII)V */ JNIEXPORT void JNICALL Java_net_towerdefender_image_ARToolkit_artoolkit_1init__Ljava_lang_String_2IIII( JNIEnv *env, jobject object, jstring calibFile, jint imageWidth, jint imageHeight, jint screenWidth, jint screenHeight) { ARParam wparam; const char *cparam_name = (*env)->GetStringUTFChars(env, calibFile, NULL); xsize = imageHeight; ysize = imageHeight; printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if (arParamLoad(cparam_name, 1, &wparam) < 0) { __android_log_write(ANDROID_LOG_ERROR, "AR native", "Camera parameter load error !!"); jclass exc = (*env)->FindClass(env, "net/towerdefender/exceptions/ARRuntimeException"); if (exc != NULL) (*env)->ThrowNew(env, exc, "Camera parameter load error !!"); //exit(EXIT_FAILURE); } #ifdef DEBUG_LOGGING else { __android_log_write(ANDROID_LOG_INFO,"AR native","Camera parameter loaded successfully !!"); } #endif arParamChangeSize(&wparam, imageWidth, imageHeight, &cparam); arInitCparam(&cparam); printf("*** Camera Parameter ***\n"); arParamDisp(&cparam); //initialize openGL stuff argInit(&cparam, 1.0, 0, screenWidth, screenHeight, 0); //gl_cpara jclass arObjectClass = (*env)->FindClass(env, "net/towerdefender/image/ARObject"); if (arObjectClass != NULL) { jfieldID glCameraMatrixFieldID = (*env)->GetStaticFieldID(env, arObjectClass, "glCameraMatrix", "[F"); if (glCameraMatrixFieldID != NULL) { jobject glCameraMatrixObj = (*env)->GetStaticObjectField(env, arObjectClass, glCameraMatrixFieldID); if (glCameraMatrixObj != NULL) { float *glCamMatrix = (*env)->GetFloatArrayElements(env, glCameraMatrixObj, JNI_FALSE); int i = 0; for (i = 0; i < 16; i++) glCamMatrix[i] = gl_cpara[i]; (*env)->ReleaseFloatArrayElements(env, glCameraMatrixObj, glCamMatrix, 0); } } } (*env)->ReleaseStringUTFChars(env, calibFile, cparam_name); }
bool ofxArtool5::setupCamera(string pthCamParam, ofVec2f _camSize, ofVec2f _viewportSize, ofPixelFormat pf){ ARParam cParam; AR_PIXEL_FORMAT pixFormat = toAR(pf); const char * cPathCamParam = ofToDataPath(pthCamParam).c_str(); camSize=_camSize; viewportSize=_viewportSize; if(arParamLoad(cPathCamParam, 1, &cParam)){ ofLogError("ofxArtool5::setupCamera()", "error loading param file"); return false; } if(cParam.xsize!=camSize.x||cParam.ysize!=camSize.y){ ofLogWarning("ofxArtool5::setupCamera()","camera param needs resizing"); arParamChangeSize(&cParam, camSize.x, camSize.y, &cParam); } if((gCparamLT = arParamLTCreate(&cParam, AR_PARAM_LT_DEFAULT_OFFSET))==NULL){ ofLogError("ofxArtool5::setupCamera()","Error: arParamLTCreate"); return false; } if(artMode==ART_PATTERN){ if((gARHandle = arCreateHandle(gCparamLT))==NULL){ ofLogError("ofxArtool5::setupCamera()","Error: arCreateHandle"); return false; } if(arSetPixelFormat(gARHandle, pixFormat)<0){ ofLogError("ofxArtool5::setupCamera()","Error arSetPixelFormat"); return false; } if(arSetDebugMode(gARHandle, AR_DEBUG_DISABLE)<0){ ofLogError("ofxArtool5::setupCamera()","Error arSetDebugMode"); return false; } if((gAR3DHandle = ar3DCreateHandle(&cParam))==NULL){ ofLogError("ofxArtool5::setupCamera()","Error ar3DCreateHandle"); return false; } }else if(artMode==ART_NFT){ arglCameraFrustumRH(&(gCparamLT->param), getMinDistance(), getMaxDistance(), cameraLens); } cvColorFrame.allocate(camSize.x, camSize.y); cvGrayFrame.allocate(camSize.x, camSize.y); return true; }
/* * Class: JARParameter * Method: JARParamChangeSize * Signature: (II)I */ JNIEXPORT jint JNICALL Java_com_clab_artoolkit_port_JARParameter_JARParamChangeSize(JNIEnv *env, jobject obj, jint xsize, jint ysize) { if(wparam==NULL) return -1; if(cparam!=NULL) delete cparam; cparam = new ARParam(); jint retval = arParamChangeSize( wparam, xsize, ysize, cparam ); return retval; }
/* * Class: com_clab_artoolkit_port_JARToolkit * Method: JARParamChangeSize * Signature: (II)I */ JNIEXPORT jint JNICALL Java_net_sourceforge_jartoolkit_core_JARToolKit_paramChangeSize(JNIEnv *env, jobject, jint xsize, jint ysize) { if(wparam==NULL) return -1; if(cparam!=NULL) delete cparam; cparam = new ARParam(); jint retval = arParamChangeSize( wparam, xsize, ysize, cparam ); return retval; }
int main(int argc,char**argv){ ARParam cparam; ARParam wparam; int xsize,ysize; glutInit(&argc,argv); if(arVideoOpen(vconf_name)<0){ puts("ビデオデバイスエラー"); return -1; } if(arVideoInqSize(&xsize,&ysize) < 0)return -1; if(arParamLoad(cparam_name,1,&wparam)< 0){ puts("パラメータ読み込み失敗"); return -1; } arParamChangeSize(&wparam,xsize,ysize,&cparam); arInitCparam(&cparam); nyobj = nyar_NyARTransMat_O2_create(&cparam); if( (patt_id=arLoadPatt(pattern_name)) < 0){ puts("パターン読み込みエラー"); return -1; } argInit(&cparam, 1.0, 0, 0, 0, 0); mqoInit(); if(Data_Load()==-1) return -1; arVideoCapStart(); InitGame(); arUtilTimerReset(); #ifdef _WIN32 TIMECAPS Caps; timeGetDevCaps(&Caps, sizeof(TIMECAPS)); // 性能取得 timeBeginPeriod(Caps.wPeriodMin); #endif argMainLoop(MouseEvent,KeyEvent,MainLoop); #ifdef _WIN32 timeEndPeriod(Caps.wPeriodMin); #endif nyar_NyARTransMat_O2_free(nyobj); return 0; }
static void nativeVideoGetCparamCallback(const ARParam *cparam_p, void *userdata) { // Load the camera parameters, resize for the window and init. ARParam cparam; if (cparam_p) cparam = *cparam_p; else { LOGE("Unable to automatically determine camera parameters. Using default.\n"); if (arParamLoad(cparaName, 1, &cparam) < 0) { LOGE("Error: Unable to load parameter file %s for camera.\n", cparaName); return; } } if (cparam.xsize != videoWidth || cparam.ysize != videoHeight) { #ifdef DEBUG LOGI("*** Camera Parameter resized from %d, %d. ***\n", cparam.xsize, cparam.ysize); #endif arParamChangeSize(&cparam, videoWidth, videoHeight, &cparam); } #ifdef DEBUG LOGI("*** Camera Parameter ***\n"); arParamDisp(&cparam); #endif if ((gCparamLT = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) { LOGE("Error: arParamLTCreate.\n"); return; } videoInited = true; // // AR init. // // Create the OpenGL projection from the calibrated camera parameters. arglCameraFrustumRHf(&gCparamLT->param, NEAR_PLANE, FAR_PLANE, cameraLens); cameraPoseValid = FALSE; if (!initNFT(gCparamLT, gPixFormat)) { LOGE("Error initialising NFT.\n"); arParamLTFree(&gCparamLT); return; } // Marker data has already been loaded, so now load NFT data on a second thread. nftDataLoadingThreadHandle = threadInit(0, NULL, loadNFTDataAsync); if (!nftDataLoadingThreadHandle) { LOGE("Error starting NFT loading thread.\n"); arParamLTFree(&gCparamLT); return; } threadStartSignal(nftDataLoadingThreadHandle); }
static int setupCamera(const char *cparam_name, char *vconf, ARParamLT **cparamLT_p) { ARParam cparam; int xsize, ysize; AR_PIXEL_FORMAT pixFormat; // Open the video path. if (arVideoOpen(vconf) < 0) { ARLOGe("setupCamera(): Unable to open connection to camera.\n"); return (FALSE); } // Find the size of the window. if (arVideoGetSize(&xsize, &ysize) < 0) { ARLOGe("setupCamera(): Unable to determine camera frame size.\n"); arVideoClose(); return (FALSE); } ARLOGi("Camera image size (x,y) = (%d,%d)\n", xsize, ysize); // Get the format in which the camera is returning pixels. pixFormat = arVideoGetPixelFormat(); if (pixFormat == AR_PIXEL_FORMAT_INVALID) { ARLOGe("setupCamera(): Camera is using unsupported pixel format.\n"); arVideoClose(); return (FALSE); } // Load the camera parameters, resize for the window and init. if (arParamLoad(cparam_name, 1, &cparam) < 0) { ARLOGe("setupCamera(): Error loading parameter file %s for camera.\n", cparam_name); arVideoClose(); return (FALSE); } if (cparam.xsize != xsize || cparam.ysize != ysize) { ARLOGw("*** Camera Parameter resized from %d, %d. ***\n", cparam.xsize, cparam.ysize); arParamChangeSize(&cparam, xsize, ysize, &cparam); } #ifdef DEBUG ARLOG("*** Camera Parameter ***\n"); arParamDisp(&cparam); #endif if ((*cparamLT_p = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) { ARLOGe("setupCamera(): Error: arParamLTCreate.\n"); arVideoClose(); return (FALSE); } return (TRUE); }
static void init( void ) { ARParam wparam; /* open the video path */ if( arVideoOpen( vconf ) < 0 ) exit(0); /* find the size of the window */ if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); /* load the paddle marker file */ if( (paddleInfo = paddleInit(paddle_name)) == NULL ) { printf("paddleInit error!!\n"); exit(0); } printf("Loaded Paddle File\n"); if( (config = arMultiReadConfigFile(config_name)) == NULL ) { printf("config data load error !!\n"); exit(0); } printf("Loaded Multi Marker File\n"); /* init items */ myListItem.itemnum=4; myListItem.item[0].pos[0]=0.;myListItem.item[0].pos[1]=0.;myListItem.item[0].onpaddle=0; myListItem.item[1].pos[0]=100.;myListItem.item[1].pos[1]=-100.;myListItem.item[1].onpaddle=0; myListItem.item[2].pos[0]=200.;myListItem.item[2].pos[1]=0.;myListItem.item[2].onpaddle=0; myListItem.item[3].pos[0]=0.;myListItem.item[3].pos[1]=0.;myListItem.item[3].onpaddle=1; /* set up the initial paddle contents */ myPaddleItem.item = 3; myPaddleItem.angle = 0.0; myPaddleItem.x = 0.0; myPaddleItem.y = 0.0; /* open the graphics window */ argInit( &cparam, 1.0, 0, 0, 0, 0 ); }
//initialisation artoolkit void arInit() { printf("Debut initialisation AR\n"); cout << vconf << endl; ARParam wparam; ///ouverture fenetre de dialogue de parametrage if( arVideoOpen( vconf ) < 0 ) /*exit(0)*/ printf("Connexion a la webcam impossible\n"); if( arVideoInqSize(&xsize, &ysize) < 0 ) /*exit(0)*/printf("Impossible de recuperer la taille de la video\n"); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); ///parametrage de la camera via la fentre de dialogue precedente if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); //exit(0); } //changement des param de base par ceux choisi lors de l'affichage de la fenetre de configuration arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); ///affichage parametres ///fin init camera ///debut init marker de detection for( int i = 0; i < 2; i++ ) { if( (object[i].patt_id=arLoadPatt(object[i].patt_name)) < 0 ) { printf("pattern load error: %s\n", object[i].patt_name); //exit(0); } } argInit( &cparam, 1.0, 0, 0, 0, 0 ); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); printf("Fin initialisation AR\n"); }
int main(int argc, char **argv) { ARParam cparam; ARParam wparam; int xsize, ysize; printf("test\n"); glutInit(&argc, argv); if (arVideoOpen(vconf_name) < 0) { printf("ビデオデバイスのエラー"); return -1; } if (arVideoInqSize(&xsize, &ysize) < 0) return -1; if (arParamLoad(cparam_name, 1, &wparam) < 0) { printf("カメラパラメータの読み込みに失敗しました\n"); return -1; } arParamChangeSize(&wparam, xsize, ysize, &cparam); arInitCparam(&cparam); if ((patt_id = arLoadPatt(patt_name)) < 0) { printf("パターンファイルの読み込みに失敗しました\n"); return -1; } argInit(&cparam, 1.0, 0, 0, 0, 0); arVideoCapStart(); argMainLoop(MouseEvent, KeyEvent, MainLoop); return 0; }
static void init( void ) { ARParam wparam; int i; /* open the video path */ if( arVideoOpen( vconf ) < 0 ) exit(0); /* find the size of the window */ if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); /* load the paddle marker file */ if( (paddleInfo = paddleInit(paddle_name)) == NULL ) { printf("paddleInit error!!\n"); exit(0); } printf("Loaded Paddle File\n"); if( (config = arMultiReadConfigFile(config_name)) == NULL ) { printf("config data load error !!\n"); exit(0); } printf("Loaded Multi Marker File\n"); /* initialize the targets */ for (i=0;i<TARGET_NUM;i++){ myTarget[i].pos[0] = 50.0*i; myTarget[i].pos[1] = -50.0*i; myTarget[i].pos[2] = 50.0*i; myTarget[i].state = NOT_TOUCHED; } /* open the graphics window */ argInit( &cparam, 1.0, 0, 0, 0, 0 ); }
static void init( void ) { ARParam wparam; /* set the initial camera parameters */ if( arParamLoad(cparam_name, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); /* open the graphics window */ argInit( &cparam, 1.0, 0, 0, 0, 0 ); }
static int setupCamera(ARParam *cparam) { ARParam wparam; char name1[256], name2[256]; int xsize, ysize; printf("Enter camera parameter filename"); printf("(Data/camera_para.dat): "); if (fgets(name1, 256, stdin) == NULL) exit(0); if (sscanf(name1, "%s", name2) != 1) { strcpy(name2, "Data/camera_para.dat"); } // Load the camera parameters. if (arParamLoad(name2, 1, &wparam) < 0 ) { printf("Parameter load error !!\n"); return (FALSE); } // Open the video path. if (arVideoOpen(vconf) < 0) { fprintf(stderr, "setupCamera(): Unable to open connection to camera.\n"); return (FALSE); } // Find the size of the window. if (arVideoInqSize(&xsize, &ysize) < 0) return (FALSE); fprintf(stdout, "Camera image size (x,y) = (%d,%d)\n", xsize, ysize); // Resize for the window and init. arParamChangeSize(&wparam, xsize, ysize, cparam); fprintf(stdout, "*** Camera Parameter ***\n"); arParamDisp(cparam); arInitCparam(cparam); if (arVideoCapStart() != 0) { fprintf(stderr, "setupCamera(): Unable to begin camera data capture.\n"); return (FALSE); } return (TRUE); }
int CWebCam::SetupWebCam(const char *cparam_names, char *vconfs) { int xsize, ysize; ARParam wparam; if((ARTVideo = ar2VideoOpen(vconfs)) == 0) return(0); if(ar2VideoInqSize(ARTVideo, &xsize, &ysize) < 0) return(0); if(arParamLoad(cparam_names, 1, &wparam) < 0) return(0); arParamChangeSize(&wparam, xsize, ysize, &ARTCparam); arInitCparam(&ARTCparam); arParamDisp(&ARTCparam); ARTThreshhold = 100; arglCameraFrustumRH(&ARTCparam, VIEW_DISTANCE_MIN, VIEW_DISTANCE_MAX, projectionMat); if(ar2VideoCapStart(ARTVideo) != 0) return(0); ar2VideoCapNext(ARTVideo); return(1); }
/* set up the application parameters - read in from command line*/ static int init(void) { char cparaname[256]; char pattname[256]; ARParam wparam; strcpy( cparaname, "Data/camera_para.dat" ); strcpy( pattname, "Data/patt.hiro" ); /* open the video path */ if( arVideoOpen( vconf ) < 0 ) exit(0); /* find the size of the window */ if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0); printf("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ if( arParamLoad(cparaname, 1, &wparam) < 0 ) { printf("Camera parameter load error !!\n"); exit(0); } arParamChangeSize( &wparam, xsize, ysize, &cparam ); arInitCparam( &cparam ); printf("*** Camera Parameter ***\n"); arParamDisp( &cparam ); /* open the graphics window */ argInit( &cparam, 2.0, 0, 2, 1, 0 ); if( (target_id = arLoadPatt(pattname)) < 0 ) { printf("Target pattern load error!!\n"); exit(0); } arDebug = 0; return 0; }
//======== // 初期化 //======== bool cARTK::initialize( void ) { const char *szCameraParamFName = "../Data/camera_para.dat"; const char *szPattFName = "../Data/patt.00"; #ifdef _WIN32 char *szVConfFName = "../Data/WDM_camera_flipV.xml"; #else char *szVConfFName = ""; #endif ARParam sCamParamTemp; int iCamImgSizeX, iCamImgSizeY; // カメラデバイスのオープン if( arVideoOpen( szVConfFName ) < 0 ) { ErrorMessage( "Unable to open connection to camera.\n" ); return false; } // カメラ画像のサイズを取得 if( arVideoInqSize( &iCamImgSizeX, &iCamImgSizeY ) < 0 ) return false; // カメラパラメータファイルの読込み if( arParamLoad( szCameraParamFName, 1, &sCamParamTemp ) < 0 ) { ErrorMessage( "Error loading parameter file for camera.\n" ); return false; } // カメラパラメータのサイズ部分を変更 arParamChangeSize( &sCamParamTemp, iCamImgSizeX, iCamImgSizeY, &m_sCameraParam ); // ライブラリ内のカメラパラメータの初期化 arInitCparam( &m_sCameraParam ); // カメラ画像のキャプチャを開始 if( arVideoCapStart() != 0 ) { ErrorMessage( "Unable to begin camera data capture.\n" ); return false; } // マーカーパターンファイルの読込み if( (m_iPattID = arLoadPatt( szPattFName )) < 0 ) { ErrorMessage( "Pattern file load error !!\n" ); return false; } m_uiARTImageSize = sizeof(ARUint8) * iCamImgSizeX * iCamImgSizeY * 3; m_pARTImage = (ARUint8 *)malloc( m_uiARTImageSize ); memset( m_pARTImage, 0, m_uiARTImageSize ); m_dViewScaleFactor = 0.16; m_dPattWidth = 40.0; m_bFirstTime = true; return true; }
static void nativeVideoGetCparamCallback(const ARParam *cparam_p, void *userdata) { // Load the camera parameters, resize for the window and init. ARParam cparam; if (cparam_p) cparam = *cparam_p; else { LOGE("Unable to automatically determine camera parameters. Using default.\n"); if (arParamLoad(cparaName, 1, &cparam) < 0) { LOGE("Error: Unable to load parameter file %s for camera.\n", cparaName); return; } } if (cparam.xsize != videoWidth || cparam.ysize != videoHeight) { #ifdef DEBUG LOGI("*** Camera Parameter resized from %d, %d. ***\n", cparam.xsize, cparam.ysize); #endif arParamChangeSize(&cparam, videoWidth, videoHeight, &cparam); } #ifdef DEBUG LOGI("*** Camera Parameter ***\n"); arParamDisp(&cparam); #endif if ((gCparamLT = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) { LOGE("Error: arParamLTCreate.\n"); return; } videoInited = true; // // AR init. // // Create the OpenGL projection from the calibrated camera parameters. arglCameraFrustumRHf(&gCparamLT->param, NEAR_PLANE, FAR_PLANE, cameraLens); cameraPoseValid = FALSE; // Init AR. arHandle = arCreateHandle(gCparamLT); if (arHandle == NULL) { LOGE("Error creating AR handle"); return; } arPattAttach(arHandle, arPattHandle); if (arSetPixelFormat(arHandle, gPixFormat) < 0) { LOGE("Error setting pixel format"); return; } ar3DHandle = ar3DCreateHandle(&gCparamLT->param); if (ar3DHandle == NULL) { LOGE("Error creating 3D handle"); return; } // Other ARToolKit setup. arSetMarkerExtractionMode(arHandle, AR_USE_TRACKING_HISTORY_V2); //arSetMarkerExtractionMode(arHandle, AR_NOUSE_TRACKING_HISTORY); //arSetLabelingThreshMode(arHandle, AR_LABELING_THRESH_MODE_MANUAL); // Uncomment to use manual thresholding. // Set the pattern detection mode (template (pictorial) vs. matrix (barcode) based on // the marker types as defined in the marker config. file. arSetPatternDetectionMode(arHandle, arPattDetectionMode); // Default = AR_TEMPLATE_MATCHING_COLOR // Other application-wide marker options. Once set, these apply to all markers in use in the application. // If you are using standard ARToolKit picture (template) markers, leave commented to use the defaults. // If you are usign a different marker design (see http://www.artoolworks.com/support/app/marker.php ) // then uncomment and edit as instructed by the marker design application. //arSetLabelingMode(arHandle, AR_LABELING_BLACK_REGION); // Default = AR_LABELING_BLACK_REGION //arSetBorderSize(arHandle, 0.25f); // Default = 0.25f //arSetMatrixCodeType(arHandle, AR_MATRIX_CODE_3x3); // Default = AR_MATRIX_CODE_3x3 }
static void init(int argc, char *argv[]) { char *vconfL = NULL; char *vconfR = NULL; char *cparaL = NULL; char *cparaR = NULL; char cparaLDefault[] = "Data/cparaL.dat"; char cparaRDefault[] = "Data/cparaR.dat"; ARParam wparam; ARGViewport viewport; int i, j; int gotTwoPartOption; int screenWidth, screenHeight, screenMargin; double wscalef, hscalef, scalef; chessboardCornerNumX = 0; chessboardCornerNumY = 0; calibImageNum = 0; patternWidth = 0.0f; i = 1; // argv[0] is name of app, so start at 1. while (i < argc) { gotTwoPartOption = FALSE; // Look for two-part options first. if ((i + 1) < argc) { if (strcmp(argv[i], "--vconfL") == 0) { i++; vconfL = argv[i]; gotTwoPartOption = TRUE; } else if (strcmp(argv[i], "--vconfR") == 0) { i++; vconfR = argv[i]; gotTwoPartOption = TRUE; } else if (strcmp(argv[i], "--cparaL") == 0) { i++; cparaL = argv[i]; gotTwoPartOption = TRUE; } else if (strcmp(argv[i], "--cparaR") == 0) { i++; cparaR = argv[i]; gotTwoPartOption = TRUE; } } if (!gotTwoPartOption) { // Look for single-part options. if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "-h") == 0) { usage(argv[0]); } else if (strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "-v") == 0) { ARLOG("%s version %s\n", argv[0], AR_HEADER_VERSION_STRING); exit(0); } else if( strncmp(argv[i], "-cornerx=", 9) == 0 ) { if( sscanf(&(argv[i][9]), "%d", &chessboardCornerNumX) != 1 ) usage(argv[0]); if( chessboardCornerNumX <= 0 ) usage(argv[0]); } else if( strncmp(argv[i], "-cornery=", 9) == 0 ) { if( sscanf(&(argv[i][9]), "%d", &chessboardCornerNumY) != 1 ) usage(argv[0]); if( chessboardCornerNumY <= 0 ) usage(argv[0]); } else if( strncmp(argv[i], "-imagenum=", 10) == 0 ) { if( sscanf(&(argv[i][10]), "%d", &calibImageNum) != 1 ) usage(argv[0]); if( calibImageNum <= 0 ) usage(argv[0]); } else if( strncmp(argv[i], "-pattwidth=", 11) == 0 ) { if( sscanf(&(argv[i][11]), "%f", &patternWidth) != 1 ) usage(argv[0]); if( patternWidth <= 0 ) usage(argv[0]); } else if( strncmp(argv[i], "-cparaL=", 8) == 0 ) { cparaL = &(argv[i][8]); } else if( strncmp(argv[i], "-cparaR=", 8) == 0 ) { cparaR = &(argv[i][8]); } else { ARLOGe("Error: invalid command line argument '%s'.\n", argv[i]); usage(argv[0]); } } i++; } if( chessboardCornerNumX == 0 ) chessboardCornerNumX = CHESSBOARD_CORNER_NUM_X; if( chessboardCornerNumY == 0 ) chessboardCornerNumY = CHESSBOARD_CORNER_NUM_Y; if( calibImageNum == 0 ) calibImageNum = CALIB_IMAGE_NUM; if( patternWidth == 0.0f ) patternWidth = (float)CHESSBOARD_PATTERN_WIDTH; if (!cparaL) cparaL = cparaLDefault; if (!cparaR) cparaR = cparaRDefault; ARLOG("CHESSBOARD_CORNER_NUM_X = %d\n", chessboardCornerNumX); ARLOG("CHESSBOARD_CORNER_NUM_Y = %d\n", chessboardCornerNumY); ARLOG("CHESSBOARD_PATTERN_WIDTH = %f\n", patternWidth); ARLOG("CALIB_IMAGE_NUM = %d\n", calibImageNum); ARLOG("Video parameter Left : %s\n", vconfL); ARLOG("Video parameter Right: %s\n", vconfR); ARLOG("Camera parameter Left : %s\n", cparaL); ARLOG("Camera parameter Right: %s\n", cparaR); if( (vidL=ar2VideoOpen(vconfL)) == NULL ) { ARLOGe("Cannot found the first camera.\n"); exit(0); } if( (vidR=ar2VideoOpen(vconfR)) == NULL ) { ARLOGe("Cannot found the second camera.\n"); exit(0); } if( ar2VideoGetSize(vidL, &xsizeL, &ysizeL) < 0 ) exit(0); if( ar2VideoGetSize(vidR, &xsizeR, &ysizeR) < 0 ) exit(0); if( (pixFormatL=ar2VideoGetPixelFormat(vidL)) < 0 ) exit(0); if( (pixFormatR=ar2VideoGetPixelFormat(vidR)) < 0 ) exit(0); ARLOG("Image size for the left camera = (%d,%d)\n", xsizeL, ysizeL); ARLOG("Image size for the right camera = (%d,%d)\n", xsizeR, ysizeR); if( arParamLoad(cparaL, 1, &wparam) < 0 ) { ARLOGe("Camera parameter load error !! %s\n", cparaL); exit(0); } arParamChangeSize( &wparam, xsizeL, ysizeL, ¶mL ); ARLOG("*** Camera Parameter for the left camera ***\n"); arParamDisp( ¶mL ); if( arParamLoad(cparaR, 1, &wparam) < 0 ) { ARLOGe("Camera parameter load error !! %s\n", cparaR); exit(0); } arParamChangeSize( &wparam, xsizeR, ysizeR, ¶mR ); ARLOG("*** Camera Parameter for the right camera ***\n"); arParamDisp( ¶mR ); screenWidth = glutGet(GLUT_SCREEN_WIDTH); screenHeight = glutGet(GLUT_SCREEN_HEIGHT); if (screenWidth > 0 && screenHeight > 0) { screenMargin = (int)(MAX(screenWidth, screenHeight) * SCREEN_SIZE_MARGIN); if ((screenWidth - screenMargin) < (xsizeL + xsizeR) || (screenHeight - screenMargin) < MAX(ysizeL, ysizeR)) { wscalef = (double)(screenWidth - screenMargin) / (double)(xsizeL + xsizeR); hscalef = (double)(screenHeight - screenMargin) / (double)MAX(ysizeL, ysizeR); scalef = MIN(wscalef, hscalef); ARLOG("Scaling %dx%d window by %0.3f to fit onto %dx%d screen (with %2.0f%% margin).\n", xsizeL + xsizeR, MAX(ysizeL, ysizeR), scalef, screenWidth, screenHeight, SCREEN_SIZE_MARGIN*100.0); } else { scalef = 1.0; } } else { scalef = 1.0; } /* open the graphics window */ if( argCreateWindow((int)((xsizeL + xsizeR)*scalef), (int)(MAX(ysizeL, ysizeR)*scalef)) < 0 ) { ARLOGe("Error: argCreateWindow.\n"); exit(0); } viewport.sx = 0; viewport.sy = 0; viewport.xsize = (int)(xsizeL*scalef); viewport.ysize = (int)(ysizeL*scalef); if( (vpL=argCreateViewport(&viewport)) == NULL ) { ARLOGe("Error: argCreateViewport.\n"); exit(0); } viewport.sx = (int)(xsizeL*scalef); viewport.sy = 0; viewport.xsize = (int)(xsizeR*scalef); viewport.ysize = (int)(ysizeR*scalef); if( (vpR=argCreateViewport(&viewport)) == NULL ) { ARLOGe("Error: argCreateViewport.\n"); exit(0); } argViewportSetPixFormat( vpL, pixFormatL ); argViewportSetPixFormat( vpR, pixFormatR ); argViewportSetCparam( vpL, ¶mL ); argViewportSetCparam( vpR, ¶mR ); argViewportSetDispMethod( vpL, AR_GL_DISP_METHOD_TEXTURE_MAPPING_FRAME ); argViewportSetDispMethod( vpR, AR_GL_DISP_METHOD_TEXTURE_MAPPING_FRAME ); argViewportSetDispMode(vpL, AR_GL_DISP_MODE_FIT_TO_VIEWPORT_KEEP_ASPECT_RATIO); argViewportSetDispMode(vpR, AR_GL_DISP_MODE_FIT_TO_VIEWPORT_KEEP_ASPECT_RATIO); calibImageL = cvCreateImage( cvSize(xsizeL, ysizeL), IPL_DEPTH_8U, 1); calibImageR = cvCreateImage( cvSize(xsizeR, ysizeR), IPL_DEPTH_8U, 1); arMalloc(cornersL, CvPoint2D32f, chessboardCornerNumX*chessboardCornerNumY); arMalloc(cornersR, CvPoint2D32f, chessboardCornerNumX*chessboardCornerNumY); arMalloc(worldCoord, ICP3DCoordT, chessboardCornerNumX*chessboardCornerNumY); for( i = 0; i < chessboardCornerNumX; i++ ) { for( j = 0; j < chessboardCornerNumY; j++ ) { worldCoord[i*chessboardCornerNumY+j].x = patternWidth*i; worldCoord[i*chessboardCornerNumY+j].y = patternWidth*j; worldCoord[i*chessboardCornerNumY+j].z = 0.0; } } arMalloc(calibData, ICPCalibDataT, calibImageNum); for( i = 0; i < calibImageNum; i++ ) { arMalloc(calibData[i].screenCoordL, ICP2DCoordT, chessboardCornerNumX*chessboardCornerNumY); arMalloc(calibData[i].screenCoordR, ICP2DCoordT, chessboardCornerNumX*chessboardCornerNumY); calibData[i].worldCoordL = worldCoord; calibData[i].worldCoordR = worldCoord; calibData[i].numL = chessboardCornerNumX*chessboardCornerNumY; calibData[i].numR = chessboardCornerNumX*chessboardCornerNumY; } return; }
static void init(int argc, char *argv[]) { ARParam cparam; ARGViewport viewport; ARPattHandle *arPattHandle; char vconf[512]; AR_PIXEL_FORMAT pixFormat; ARUint32 id0, id1; int i; if (argc == 1) vconf[0] = '\0'; else { strcpy(vconf, argv[1]); for (i = 2; i < argc; i++) { strcat(vconf, " "); strcat(vconf, argv[i]); } } /* open the video path */ if (arVideoOpen(vconf) < 0) exit(0); if (arVideoGetSize(&xsize, &ysize) < 0) exit(0); ARLOG("Image size (x,y) = (%d,%d)\n", xsize, ysize); if ((pixFormat = arVideoGetPixelFormat()) < 0) exit(0); if (arVideoGetId(&id0, &id1) == 0) { ARLOG("Camera ID = (%08x, %08x)\n", id1, id0); sprintf(vconf, VPARA_NAME, id1, id0); if (arVideoLoadParam(vconf) < 0) { ARLOGe("No camera setting data!!\n"); } } /* set the initial camera parameters */ if (arParamLoad(CPARA_NAME, 1, &cparam) < 0) { ARLOGe("Camera parameter load error !!\n"); exit(0); } arParamChangeSize(&cparam, xsize, ysize, &cparam); ARLOG("*** Camera Parameter ***\n"); arParamDisp(&cparam); if ((gCparamLT = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) { ARLOGe("Error: arParamLTCreate.\n"); exit(-1); } if ((arHandle = arCreateHandle(gCparamLT)) == NULL) { ARLOGe("Error: arCreateHandle.\n"); exit(0); } if (arSetPixelFormat(arHandle, pixFormat) < 0) { ARLOGe("Error: arSetPixelFormat.\n"); exit(0); } if ((ar3DHandle = ar3DCreateHandle(&cparam)) == NULL) { ARLOGe("Error: ar3DCreateHandle.\n"); exit(0); } if ((arPattHandle = arPattCreateHandle()) == NULL) { ARLOGe("Error: arPattCreateHandle.\n"); exit(0); } if ((patt_id = arPattLoad(arPattHandle, PATT_NAME)) < 0) { ARLOGe("pattern load error !!\n"); exit(0); } arPattAttach(arHandle, arPattHandle); /* open the graphics window */ w1 = argCreateWindow(xsize, ysize); viewport.sx = 0; viewport.sy = 0; viewport.xsize = xsize; viewport.ysize = ysize; if ((vp1 = argCreateViewport(&viewport)) == NULL) exit(0); argViewportSetCparam(vp1, &cparam); argViewportSetPixFormat(vp1, pixFormat); argViewportSetDispMethod(vp1, AR_GL_DISP_METHOD_TEXTURE_MAPPING_FRAME); argViewportSetDispMode(vp1, AR_GL_DISP_MODE_FIT_TO_VIEWPORT); argViewportSetDistortionMode(vp1, AR_GL_DISTORTION_COMPENSATE_ENABLE); w2 = argCreateWindow(xsize, ysize); viewport.sx = 0; viewport.sy = 0; viewport.xsize = xsize; viewport.ysize = ysize; if ((vp2 = argCreateViewport(&viewport)) == NULL) exit(0); argViewportSetCparam(vp2, &cparam); argViewportSetPixFormat(vp2, pixFormat); argViewportSetDispMethod(vp2, AR_GL_DISP_METHOD_TEXTURE_MAPPING_FRAME); argViewportSetDispMode(vp2, AR_GL_DISP_MODE_FIT_TO_VIEWPORT); argViewportSetDistortionMode(vp2, AR_GL_DISTORTION_COMPENSATE_DISABLE); return; }