void initVariables() { cam.setOrthoGraphicProjection((bool)str2num<int>(parameters.find("OrthographicMode"))); drawInfo = (bool)util::str2num<int>(parameters.find("DrawInfo")); //cam.setOrthoGraphicProjection(orthoMode); cerr << "COMPUTED IOD=" << interoculardistance << endl; trial.init(parameters); stimulusTime=util::str2num<double>(parameters.find("StimulusTime")); trialTimer.start(); trial.next(); interoculardistance = str2num<double>(parameters.find("IOD"))*trial.getCurrent().at("IODFactor"); int textureResolution = util::str2num<int>(parameters.find("TextureResolution")); int maxTextureResolutionZ = (int) std::ceil(textureResolution*util::str2num<double>(parameters.find("MaxCurvatureZ"))); // allocate the texture memory if (parameters.find("UsePolkaDots")=="1") { surface.resize(textureResolution,textureResolution, maxTextureResolutionZ); surface.initializeSurfaceShaders(VolumetricSurfaceIntersection::SurfaceParabolicCylinder); } updateStimulus(trial.getCurrent().at("CurvatureZ")); CurvatureZ=0.0; }
void initRendering() { glEnable(GL_DEPTH_TEST); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable (GL_BLEND); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_NORMALIZE); glEnable(GL_COLOR_MATERIAL); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.init(Screen(20,20,0,0,focalDistance)); cam.setNearFarPlanes(1.0,200.0); cam.setOrthoGraphicProjection(true); }
void handleKeypress(unsigned char key, int x, int y) { switch (key) { //Quit program case 'o': orthographicMode=!orthographicMode; cam.setOrthoGraphicProjection(orthographicMode); break; case 'z': zOnFocalPlane=!zOnFocalPlane; break; case 'p': passiveMode=!passiveMode; break; case 'q': case 27: { cleanup(); exit(0); } break; case '2': { probeAngle=270; keyPressed(); } break; case '8': { probeAngle=90; keyPressed(); } break; case '4': { probeAngle=180; keyPressed(); } break; case '6': { probeAngle=0; keyPressed(); } break; } }
void handleKeypress(unsigned char key, int x, int y) { switch (key) { //Quit program case 'o': orthographicMode=!orthographicMode; cam.setOrthoGraphicProjection(orthographicMode); break; case 'z': zOnFocalPlane=!zOnFocalPlane; break; case 'p': passiveMode=!passiveMode; break; case 'q': case 27: { cleanup(); exit(0); } break; case ' ': { // Here we record the head shape - coordinates of eyes and markers, but centered in (0,0,0) if ( headCalibrationDone==0 && allVisibleHead ) { headEyeCoords.init(markers[17],markers[18], markers[1],markers[2],markers[3],interoculardistance ); headCalibrationDone=1; break; } // Second calibration, you must look a fixed fixation point if ( headCalibrationDone==1 ) { headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[1], markers[2],markers[3],interoculardistance ); eyeCalibration=headEyeCoords.getRightEye(); headCalibrationDone=2; break; } if ( headCalibrationDone==2 ) { headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[1], markers[2],markers[3],interoculardistance ); eyeCalibration=headEyeCoords.getRightEye(); break; } } break; // Enter key: press to make the final calibration case 13: { if ( headCalibrationDone == 2) { headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[1], markers[2],markers[3],interoculardistance ); eyeCalibration=headEyeCoords.getRightEye(); headCalibrationDone=3; } } break; case '2': { probeAngle=270; keyPressed(); } break; case '8': { probeAngle=90; keyPressed(); } break; case '4': { probeAngle=180; keyPressed(); } break; case '6': { probeAngle=0; keyPressed(); } break; } }