void drawGLScene() { if (stereo) { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeRight); drawTrial(); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeLeft); drawTrial(); glutSwapBuffers(); } else // MONOCULAR { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if ( (int) factors["Anchored"] != 0 ) cam.setEye(Vector3d(fixationPoint.x(),fixationPoint.y(),0)); else cam.setEye(Vector3d::Zero()); drawTrial(); glutSwapBuffers(); } }
// X CARLO: In questa funzione mettere solamente chiamate a funzioni e non inserire codice libero!!! // Preferibilmente deve restare cosi e devi solo lavorare sulla drawTrial altrimenti il codice diventa un casino // Se mai volessi simulare che il centro di proiezione si muove rispetto alla vera coordinate dell'occhio // devi modificare cam.setEye(...) void drawGLScene() { if (stereo) { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeLeft); drawTrial(); drawInfo(); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeRight); drawTrial(); drawInfo(); glutSwapBuffers(); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(eyeRight); drawTrial(); drawInfo(); glutSwapBuffers(); } }
void drawStimulus() { if( fingerCalibrationDone==3 && index.z() < (startingPoint - 40.0) ) { fingersAtStart=false; letStimTimer=true; if(stimTimer.getElapsedTimeInMilliSec() < str2num<int>(parameters.find("TestStimulusDuration"))) { if ( isStimulusDrawn ) { // Central rod on focal plane glPushMatrix(); glLoadIdentity(); glTranslated(0,0,factors["AbsDepth"]+(estdepth/2)); stimDrawer[0].draw(); glPopMatrix(); // Left rod shifted 2 cm behind the focal plane glPushMatrix(); glLoadIdentity(); glTranslated(-estsize/2,0,factors["AbsDepth"]-(estdepth/2)); stimDrawer[1].draw(); glPopMatrix(); // Right rod shifted 2 cm behind the focal plane glPushMatrix(); glLoadIdentity(); glTranslated(estsize/2,0,factors["AbsDepth"]-(estdepth/2)); stimDrawer[2].draw(); glPopMatrix(); } else { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeLeft); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeRight); glutSwapBuffers(); } } else { endTrial=true; letStimTimer=false; isStimulusDrawn=false; } } else { fingersAtStart=true; } }
// X CARLO: In questa funzione mettere solamente chiamate a funzioni e non inserire codice libero!!! // Preferibilmente deve restare cosi e devi solo lavorare sulla drawTrial altrimenti il codice diventa un casino // Se mai volessi simulare che il centro di proiezione si muove rispetto alla vera coordinate dell'occhio // devi modificare cam.setEye(...) void drawGLScene() { if (stereo) { if(fingerCalibrationDone==3 && !endTrial) { if(timer.getElapsedTimeInMilliSec() < 1500) { if(index.z() > (factors["AbsDepth"]+2.0) ) transportView(); else pointingView(); } else { beepOk(1); endTrial=true; } } else drawBlack(); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(eyeRight); drawTrial(); drawInfo(); glutSwapBuffers(); } }
void drawTrial() { switch ( trialMode ) { case FIXATIONMODE: { drawFixation(); } break; case PROBEMODE : { // this is to avoid to flickering of probe... initProjectionScreen(focalDistance,Affine3d::Identity()); // updates the model view and projection matrix cam.setEye(eyeRight); drawProbe(); } break; case STIMULUSMODE: { responseTimer.start(); drawRedDotsPlane(); } break; default: { drawFixation(); } } }
void pointingView() { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(viewPointingLeft,0.0,0.0,1.0); cam.setEye(eyeLeft); drawInfo(); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(viewPointingRight,0.0,0.0,1.0); cam.setEye(eyeRight); drawInfo(); glutSwapBuffers(); }
void drawTheVoid() { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeLeft); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeRight); glutSwapBuffers(); }
void drawGLScene() { if (stereo) { // Draw the right eye view on the left buffer glDrawBuffer(GL_BACK); glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeRight); drawInfo(); drawTrial(); // Draw the left eye view on the right buffer glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); //cam.setEye(eyeLeft); così è senza disparità cam.setEye(eyeRight); if ( headCalibrationDone <3) { drawInfo(); drawTrial(); } drawInfo(); // Doesn't draw the right eye view if is not binocular if ( (int)(factors.at("Binocular"))==1 && (headCalibrationDone==3) ) { drawTrial(); } glutSwapBuffers(); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(eyeRight); drawInfo(); drawTrial(); glutSwapBuffers(); } }
void drawGLScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(Vector3d(interoculardistance/2,0,0)); drawTrial(); glutSwapBuffers(); }
void drawGLScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0, 0.0, 0.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(eyeRight); drawInfo(); glutSwapBuffers(); }
void drawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(Vector3d(0.0,0.0,0.0)); drawThings(); glutSwapBuffers(); }
void drawGLScene() { if (stereo) { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(1.0,1.0,1.0,1.0); cam.setEye(eyeRight); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(1.0,1.0,1.0,1.0); cam.setEye(eyeLeft); glutSwapBuffers(); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(1.0,1.0,1.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(eyeRight); glLineWidth(3); glPushMatrix(); glLoadIdentity(); // Here we draw the central cross, must be 150 millimeters on horizontal and vertical in order to have a correct monitor calibration glColor3fv(glBlack); glBegin(GL_LINES); glVertex3d(-crossSize/2,0,baseFocalDistance); glVertex3d(crossSize/2,0,baseFocalDistance); glVertex3d(0,crossSize/2,baseFocalDistance); glVertex3d(0,-crossSize/2,baseFocalDistance); glEnd(); glPopMatrix(); glutSwapBuffers(); } }
Affine3d getPassiveMatrix() { Screen screenPassive; screenPassive.setWidthHeight(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH); screenPassive.setOffset(alignmentX,alignmentY); screenPassive.setFocalDistance(0); screenPassive.transform(headEyeCoords.getRigidStart().getFullTransformation()*Translation3d(Vector3d(0,0,focalDistance))); VRCamera camPassive; camPassive.init(screenPassive); camPassive.setDrySimulation(true); camPassive.setEye(eyeRight); return ( camPassive.getModelViewMatrix()*objectActiveTransformation ); }
void drawGLScene() { if (stereo) { // back on both windows (left and right) glDrawBuffer(GL_BACK); // now start switching between presentations: // Draw left eye view first glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeLeft); drawStimulus(); drawInfo(); // Draw right eye view afterwards glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeRight); drawStimulus(); drawInfo(); // swap between buffers glutSwapBuffers(); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(eyeRight); drawStimulus(); drawInfo(); glutSwapBuffers(); } }
void drawGLScene() { if (stereo) { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeRight); drawInfo(); drawTrial(); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); cam.setEye(eyeLeft); drawInfo(); drawTrial(); glutSwapBuffers(); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(eyeRight); if ( (int) factors["Rotation"] == 0 ) cam.setEye(Vector3d(eyeRight.x()*factors["FollowingSpeed"],eyeRight.y(),eyeRight.z())); drawInfo(); drawTrial(); glutSwapBuffers(); } }
void drawGLScene() { //cam.setOrthoGraphicProjection(true); if (stereo) { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(Vector3d(interoculardistance/2,0,0)); glTranslated(0,0,focalDistance); drawTrial(); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(Vector3d(-interoculardistance/2,0,0)); glTranslated(0,0,focalDistance); drawTrial(); glutSwapBuffers(); } else // MONOCULAR { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cam.setEye(Vector3d::Zero()); glTranslated(0,0,focalDistance); drawTrial(); glutSwapBuffers(); } }
void drawTrial() { switch ( trialMode ) { case FIXATIONMODE: { drawFixation(); } break; case PROBEMODE : { // this is to avoid to flickering of probe... initProjectionScreen(focalDistance,Affine3d::Identity()); // updates the model view and projection matrix cam.setEye(eyeRight); drawProbe(); } break; case STIMULUSMODE: { responseTimer.start(); /* // x_dim= str2num<double>(parameters.find("planeXdimension")) + mathcommon::unifRand(0,100); num_dots= int(floor((x_dim[0]*str2num<double>(parameters.find("planeYdimension")))*(str2num<int>(parameters.find("numberdots"))/(str2num<double>(parameters.find("planeXdimension"))*str2num<double>(parameters.find("planeYdimension")))))); redDotsPlane[0].setNpoints(num_dots); //XXX controllare densita di distribuzione dei punti redDotsPlane[0].setDimensions(x_dim[0],str2num<double>(parameters.find("planeYdimension")),0.01); //x_dim= str2num<double>(parameters.find("planeXdimension")) + mathcommon::unifRand(0,100); num_dots= int(floor((x_dim[1]*str2num<double>(parameters.find("planeYdimension")))*(str2num<int>(parameters.find("numberdots"))/(str2num<double>(parameters.find("planeXdimension"))*str2num<double>(parameters.find("planeYdimension")))))); redDotsPlane[1].setNpoints(num_dots); //XXX controllare densita di distribuzione dei punti redDotsPlane[1].setDimensions(x_dim[1],str2num<double>(parameters.find("planeYdimension")),0.01); // redDotsPlane[0].setDimensions(str2num<double>(parameters.find("planeXdimension"))+mathcommon::unifRand(0,100),str2num<double>(parameters.find("planeYdimension")),0.01); // redDotsPlane[1].setDimensions(str2num<double>(parameters.find("planeXdimension"))+mathcommon::unifRand(0,100),str2num<double>(parameters.find("planeYdimension")),0.01); */ drawRedDotsPlane(); if ( str2num<int>(parameters.find("Occluder"))) //if ((int) factors.at("Occluder")) /// if factor scommenta rectangle(str2num<double>(parameters.find("OccluderWidth")),str2num<double>(parameters.find("OccluderHeight")),focalDistance + str2num<double>(parameters.find("OccluderDistance"))); /// Added: Draw an occluding rectangle infront of the twsited structure } break; default: { drawFixation(); } } }
void drawGLScene() { if (stereo) { glDrawBuffer(GL_BACK); // Draw left eye view glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); if ( trialMode == STIMULUSMODE ) cam.setEye(eyeRight+translationFactor); else cam.setEye(eyeRight); drawInfo(); drawTrial(); // Draw right eye view glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); if ( trialMode == STIMULUSMODE ) cam.setEye(eyeLeft+translationFactor); else cam.setEye(eyeLeft); drawInfo(); drawTrial(); glutSwapBuffers(); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.0,0.0,1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if ( trialMode == STIMULUSMODE ) cam.setEye(eyeRight+translationFactor); else cam.setEye(eyeRight); if ( (int) factors["Translation"] == -2 ) cam.setEye(Vector3d(0,0,eyeRight.z())); drawInfo(); drawTrial(); glutSwapBuffers(); } }
void update(int value) { // Conta i cicli di presentazione dello stimolo if ( (sumOutside > str2num<int>(parameters.find("StimulusCycles")) ) && (trialMode == STIMULUSMODE) ) { sumOutside=0; trialMode++; trialMode=trialMode%4; } if (conditionInside && (sumOutside*2 > str2num<int>(parameters.find("FixationCycles"))) && (trialMode ==FIXATIONMODE ) ) { sumOutside=0; trialMode++; trialMode=trialMode%4; stimulusDuration.start(); } if ( trialMode == STIMULUSMODE ) stimulusFrames++; if ( trialMode == FIXATIONMODE ) stimulusFrames=0; Screen screenPassive; screenPassive.setWidthHeight(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH); screenPassive.setOffset(alignmentX,alignmentY); screenPassive.setFocalDistance(0); screenPassive.transform(headEyeCoords.getRigidStart().getFullTransformation()*Translation3d(center)); camPassive.init(screenPassive); camPassive.setDrySimulation(true); camPassive.setEye(eyeRight); objectPassiveTransformation = ( camPassive.getModelViewMatrix()*objectActiveTransformation ); // Coordinates picker markers = optotrak.getAllPoints(); if ( isVisible(markers[1]) && isVisible(markers[2]) && isVisible(markers[3]) ) headEyeCoords.update(markers[1],markers[2],markers[3]); Affine3d active = headEyeCoords.getRigidStart().getFullTransformation(); eulerAngles.init( headEyeCoords.getRigidStart().getFullTransformation().rotation() ); eyeLeft = headEyeCoords.getLeftEye(); eyeRight = headEyeCoords.getRightEye(); cyclopeanEye = (eyeLeft+eyeRight)/2.0; // Projection of view normal on the focal plane Vector3d directionOfSight = (active.rotation()*Vector3d(0,0,-1)).normalized(); Eigen::ParametrizedLine<double,3> lineOfSightRight = Eigen::ParametrizedLine<double,3>::Through( eyeRight , eyeRight+directionOfSight ); Eigen::ParametrizedLine<double,3> lineOfSightLeft = Eigen::ParametrizedLine<double,3>::Through( eyeLeft, eyeLeft+directionOfSight ); double lineOfSightRightDistanceToFocalPlane = lineOfSightRight.intersection(focalPlane); double lineOfSightLeftDistanceToFocalPlane = lineOfSightLeft.intersection(focalPlane); //double lenghtOnZ = (active*(center-eyeCalibration )+eyeRight).z(); projPointEyeRight = lineOfSightRightDistanceToFocalPlane *(directionOfSight)+ (eyeRight); projPointEyeLeft= lineOfSightLeftDistanceToFocalPlane * (directionOfSight) + (eyeLeft); // second projection the fixation point computed with z non constant but perfectly parallel to projPointEyeRight lineOfSightRightDistanceToFocalPlane= (( active.rotation()*(center)) - eyeRight).norm(); Vector3d secondProjection = lineOfSightRightDistanceToFocalPlane *(directionOfSight)+ (eyeRight); if ( !zOnFocalPlane ) projPointEyeRight=secondProjection ; // Compute the translation to move the eye in order to avoid shear components Vector3d posAlongLineOfSight = (headEyeCoords.getRigidStart().getFullTransformation().rotation())*(eyeRight -eyeCalibration); switch ( (int)factors["Translation"] ) { case -1: case -2: translationFactor.setZero(); if ( trialMode == STIMULUSMODE ) projPointEyeRight=center; break; case 0: translationFactor.setZero(); break; case 1: translationFactor = factors["TranslationConstant"]*Vector3d(posAlongLineOfSight.z(),0,0); break; case 2: translationFactor = factors["TranslationConstant"]*Vector3d(0,posAlongLineOfSight.z(),0); break; } if ( passiveMode ) initProjectionScreen(0,headEyeCoords.getRigidStart().getFullTransformation()*Translation3d(Vector3d(0,0,focalDistance))); else initProjectionScreen(focalDistance,Affine3d::Identity()); checkBounds(); /**** Save to file part ****/ // Markers file save the used markers and time-depending experimental variable to a file // (Make sure that in passive experiment the list of variables has the same order) markersFile << trialNumber << " " << headCalibrationDone << " " << trialMode << " " ; markersFile <<markers[1].transpose() << " " << markers[2].transpose() << " " << markers[3].transpose() << " " << markers[17].transpose() << " " << markers[18].transpose() << " " ; markersFile << factors["Tilt"] << " " << factors["Slant"] << " " << factors["Translation"] << " " << factors["Onset"] << " " << factors["TranslationConstant"] << endl; ofstream outputfile; outputfile.open("data.dat"); outputfile << "Subject Name: " << parameters.find("SubjectName") << endl; outputfile << "Passive matrix:" << endl << objectPassiveTransformation.matrix() << endl; outputfile << "Yaw: " << toDegrees(eulerAngles.getYaw()) << endl <<"Pitch: " << toDegrees(eulerAngles.getPitch()) << endl; outputfile << "EyeLeft: " << headEyeCoords.getLeftEye().transpose() << endl; outputfile << "EyeRight: " << headEyeCoords.getRightEye().transpose() << endl << endl; outputfile << "Slant: " << instantPlaneSlant << endl; outputfile << "(Width,Height) [px]: " << getPlaneDimensions().transpose() << " " << endl; outputfile << "Factors:" << endl; for (map<string,double>::iterator iter=factors.begin(); iter!=factors.end(); ++iter) { outputfile << "\t\t" << iter->first << "= " << iter->second << endl; } outputfile << "Trial remaining: " << trial.getRemainingTrials()+1 << endl; outputfile << "Last response: " << probeAngle << endl; // Here we save plane projected width and height // now rewind the file outputfile.clear(); outputfile.seekp(0,ios::beg); // Write down frame by frame the trajectories and angles of eyes and head if ( trialMode == STIMULUSMODE && headCalibrationDone > 2 ) { trajFile << setw(6) << left << trialNumber << " " << stimulusFrames << " " << eyeRight.transpose() << endl; anglesFile << setw(6) << left << trialNumber << " " << stimulusFrames << " " << toDegrees(eulerAngles.getPitch()) << " " << toDegrees(eulerAngles.getRoll()) << " " << toDegrees(eulerAngles.getYaw()) << " " << instantPlaneSlant << endl; matrixFile << setw(6) << left << trialNumber << " " << stimulusFrames << " " ; for (int i=0; i<3; i++) matrixFile << objectPassiveTransformation.matrix().row(i) << " " ; matrixFile << endl; // Write the 13 special extremal points on stimFile stimFile << setw(6) << left << trialNumber << " " << stimulusFrames << " " ; double winx=0,winy=0,winz=0; for (PointsRandIterator iRand = redDotsPlane.specialPointsRand.begin(); iRand!=redDotsPlane.specialPointsRand.end(); ++iRand) { Point3D *p=(*iRand); Vector3d v = objectActiveTransformation*Vector3d( p->x, p->y, p->z); gluProject(v.x(),v.y(),v.z(), (&cam)->getModelViewMatrix().data(), (&cam)->getProjectiveMatrix().data(), (&cam)->getViewport().data(), &winx,&winy,&winz); stimFile << winx << " " << winy << " " << winz << " "; } stimFile << endl; } glutPostRedisplay(); glutTimerFunc(TIMER_MS, update, 0); }