Example #1
0
void keyboard(unsigned char key, int x, int y) 
{
  switch(key) {
    case '+':
      amount++;
      std::cout << "amount set to " << amount << "\n";
      break;
    case '-':
      amount--;
      std::cout << "amount set to " << amount << "\n"; 
      break;
    case 'i':
      if(useGlu) {
        std::cout << "Please disable glm::LookAt by pressing 'g'"
          << " before running tests\n";
      }	
      else if(!allowGrader) {
        std::cout << "Error: no input file specified for grader\n";
      } else {
        std::cout << "Running tests...\n";
        grader.runTests();
        std::cout << "Done! [ESC to quit]\n";
      }
      break;
    case 'g':
      useGlu = !useGlu;
      reshape(w,h); 
      std::cout << "Using glm::LookAt and glm::Perspective set to: " 
        << (useGlu ? " true " : " false ") << "\n"; 
      break;
    case 'h':
      printHelp();
      break;
    case 27:  // Escape to quit
      exit(0);
      break;
    case 'r': // reset eye and up vectors, scale and translate. 
      eye = eyeinit; 
      up = upinit; 
      amount = amountinit;
      transop = view;
      sx = sy = 1.0; 
      tx = ty = 0.0; 
      break;   
    case 'v': 
      transop = view;
      std::cout << "Operation is set to View\n"; 
      break; 
    case 't':
      transop = translate; 
      std::cout << "Operation is set to Translate\n"; 
      break; 
    case 's':
      transop = scale; 
      std::cout << "Operation is set to Scale\n"; 
      break; 
  }
  glutPostRedisplay();
}
Example #2
0
void keyboard(unsigned char key,int x,int y) {
	switch(key) {
	case '+':
		amount++;
		std::cout << "amount set to " << amount << "\n";
		break;
	case '-':
		amount--;
		std::cout << "amount set to " << amount << "\n"; 
		break;
	case 'i':
		if(useGlu) {
			std::cout << "Please disable glm::LookAt by pressing 'g'"
				  << " before running tests\n";
		}
		else if(!allowGrader) {
			std::cout << "Error: no input file specified for grader\n";
		} else {
			std::cout << "Running tests...\n";
			grader.runTests();
			std::cout << "Done! [ESC to quit]\n";
		}
		break;
	case 'g':
		useGlu = !useGlu;
		std::cout << "Using glm::LookAt set to: " 
			<< (useGlu ? " true " : " false ") << "\n"; 
		break;
	case 'h':
		printHelp();
		break;
	case 27:  // Escape to quit
		exit(0);
		break;
	case 'r': // reset eye and up vectors 
		eye = eyeinit; 
		up = upinit; 
		amount = amountinit;
		std::cout << "eye and up vectors reset, amount set to " << amountinit << "\n";
		break;                 
	}
	glutPostRedisplay();
}
Example #3
0
void keyboard(unsigned char key, int x, int y) {
	switch(key) {
        case 'w':
            stopObjTransform();
            break;
        case 'o':
            stopObjTransform();
            startObjTransform();
            break;
        case '+':
            amount++;
            std::cout << "amount set to " << amount << "\n" ;
            break;
        case '-':
            amount--;
            std::cout << "amount set to " << amount << "\n" ;
            break;
        case 'i':
            if(allowGrader) {
                std::cout << "Running tests...\n";
                grader.runTests();
                std::cout << "Done! [ESC to quit]\n";
            } else {
                std::cout << "Error: no input file specified for grader\n";
            }
            break;
        case 'g':
            useGlu = !useGlu;
            reshape(w,h) ;
            std::cout << "Using glm::LookAt and glm::Perspective set to: " << (useGlu ? " true " : " false ") << "\n" ;
            break;
        case 'h':
            printHelp();
            break;
        case 'x':
            std::cout << "printing image...\n";
            fileName << "extra_credit.obj.screenshot_" << screenshotCount << ".png";
            saveScreenshot(fileName.str());
            fileName.str("");
            screenshotCount++;
            break;
        case 27:  // Escape to quit
            exit(0) ;
            break ;
        case 'r': // reset eye and up vectors, scale and translate.
            for(int i = 0; i < 4*numLights; i++) lightposn[i] = lightposnReset[i];
            for(int k = 0; k < numobjects; k++){
                object * obj = &(objects[k]);
                obj -> transform = obj -> transformOriginal;
            }
            eye = eyeinit ;
            up = upinit ;
            sx = sy = 1.0 ;
            tx = ty = 0.0 ;
            break ;
        case 'v':
            transop = view ;
            std::cout << "Operation is set to View\n" ;
            break ;
        case 't':
            transop = translate ;
            std::cout << "Operation is set to Translate\n" ;
            break ;
        case 's':
            transop = scale ;
            std::cout << "Operation is set to Scale\n" ;
            break ;
        case '0':
            transop = lightop;
            activeLight = 0;
            std::cout << "Operation is set to light 0 movement\n";
            break;
        case '1':
            transop = lightop;
            activeLight = 1;
            std::cout << "Operation is set to light 1 movement\n";
            break;
        case '2':
            transop = lightop;
            activeLight = 2;
            std::cout << "Operation is set to light 2 movement\n";
            break;
        case '3':
            transop = lightop;
            activeLight = 3;
            std::cout << "Operation is set to light 3 movement\n";
            break;
        case '4':
            transop = lightop;
            activeLight = 4;
            std::cout << "Operation is set to light 4 movement\n";
            break;
        case '5':
            transop = lightop;
            activeLight = 5;
            std::cout << "Operation is set to light 5 movement\n";
            break;
        case '6':
            transop = lightop;
            activeLight = 6;
            std::cout << "Operation is set to light 6 movement\n";
            break;
        case '7':
            transop = lightop;
            activeLight = 7;
            std::cout << "Operation is set to light 7 movement\n";
            break;
        case '8':
            transop = lightop;
            activeLight = 8;
            std::cout << "Operation is set to light 8 movement\n";
            break;
        case '9':
            transop = lightop;
            activeLight = 9;
            std::cout << "Operation is set to light 9 movement\n";
            break;
    }
	glutPostRedisplay();
}