void specialKeyboardF(int key, int x, int y) { switch(key) { case GLUT_KEY_F11: glutFullScreenToggle(); break; case GLUT_KEY_UP: glTranslatef(0,-ds,0); b.y+=ds; break; case GLUT_KEY_DOWN: glTranslatef(0,ds,0); b.y-=ds; break; case GLUT_KEY_LEFT: glTranslatef(ds,0,0); b.x-=ds; break; case GLUT_KEY_RIGHT: glTranslatef(-ds,0,0); b.x+=ds; break; } }
void keyPressed(unsigned char key, int mouseX, int mouseY){ switch(key) { case 27:/* Esc */ exit(0); break; case 'f': glutFullScreenToggle(); break; case 'w' : move(Forward); break; case 's' : move(Backward); break; case 'a' : move(Left); break; case 'd' : move(Right); break; } // Flag indicating that current window needs to be redisplayed glutPostRedisplay(); }
void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) { if (cChar == 27) glutLeaveMainLoop(); else if (cChar=='f') { printf("main window toggle fullscreen\n"); glutFullScreenToggle(); } else if (cChar=='r') { printf("main window resize\n"); if (nWidth<400) glutReshapeWindow(600,300); else glutReshapeWindow(300,300); } else if (cChar=='m') { printf("main window position\n"); /* The window position you request is the outer top-left of the window, * the client area is at a different position if the window has borders * and/or a title bar. */ if (nPosX<400) glutPositionWindow(600,300); else glutPositionWindow(300,300); } }
void keyboardF(unsigned char key, int x, int y) { switch(key) { case '+': glTranslatef(b.x,b.y,0); glScalef(scalef,scalef,1); glTranslatef(-b.x,-b.y,0); ds/=scalef; a/=scalef; break; case '-': glTranslatef(b.x,b.y,0); glScalef(1/scalef,1/scalef,1); glTranslatef(-b.x,-b.y,0); ds*=scalef; a*=scalef; break; case 'p': case 'P': case ' ': ACTIVE=!ACTIVE; break; case 'f': case 'F': glutFullScreenToggle(); break; case 'r': case 'R': init(num); break; case 'q': case 'Q': case 27: Stars.Clear(); exit(0); break; } }
void gldriver_on_key_special_down(int key, int x, int y) { _capslock_hackaround(); int scancode = _glutkey_to_scancode(key); if (scancode == SCODE_F11) { glutFullScreenToggle(); } //LOG("onKeySpecialDown %08x(%d) -> %02X(%d)", key, key, scancode, scancode); c_keys_handle_input(scancode, 1, 0); }
void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: g_bExitESC = true; exit(EXIT_SUCCESS); break; case 'f': if (!fullscreen) { fullscreen = 1; glutFullScreenToggle(); } else { fullscreen = 0; glutLeaveFullScreen(); } break; case 'r': pthread_mutex_lock(&display_mutex); memset(hvfield, 0, sizeof(cData) * DS); cudaMemcpy(dvfield, hvfield, sizeof(cData) * DS, cudaMemcpyHostToDevice); initParticles(particles, DIM, DIM); #ifndef OPTIMUS cudaGraphicsUnregisterResource(cuda_vbo_resource); getLastCudaError("cudaGraphicsUnregisterBuffer failed"); #endif #if defined(OPTIMUS) || defined(BROADCAST) cudaMemcpy(particles_gpu, particles, sizeof(cData) * DS, cudaMemcpyHostToDevice); #endif glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo); glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(cData) * DS, particles, GL_DYNAMIC_DRAW_ARB); glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); #ifndef OPTIMUS cudaGraphicsGLRegisterBuffer(&cuda_vbo_resource, vbo, cudaGraphicsMapFlagsNone); getLastCudaError("cudaGraphicsGLRegisterBuffer failed"); #endif pthread_mutex_unlock(&display_mutex); break; default: break; } }
void OpenGLApplicationBase::KeyboardCB(unsigned char Key, int x, int y) { switch (Key) { case 'd' : case 'D': cout << "Doug Blase" << endl; break; case 'q': case 27: glutLeaveMainLoop(); break; case 'f': glutFullScreenToggle(); break; } } // end KeyboardCB
/** * Function: * Calls a method of the the OpenGLApplicationBase class. Registered with GLUT by calling glutKeyboardFunc. * @param Key The generated ASCII character for the key whose press triggered the callback. * @param x The x-coordinate of the mouse relative to the window at the time the key is pressed. * @param y The y-coordinate of the mouse relative to the window at the time the key is pressed. */ static void KeyboardCB(unsigned char key, int x, int y) { switch (key) { case('f') : case('F') : // 'f' key to toggle full screen glutFullScreenToggle(); break; case(27) : // Escape key glutLeaveMainLoop(); break; default: cout << key << " key pressed." << endl; } // Signal the operating system to re-render the window glutPostRedisplay(); } // end KeyboardCB
void specialKeyPressed(int key_pressed, int mouse_x, int mouse_y) { switch (key_pressed) { case GLUT_KEY_RIGHT: vecSpecialKeyPressed[GLUT_KEY_RIGHT] = true; break; case GLUT_KEY_LEFT: vecSpecialKeyPressed[GLUT_KEY_LEFT] = true; break; case GLUT_KEY_DOWN: vecSpecialKeyPressed[GLUT_KEY_DOWN] = true; break; case GLUT_KEY_UP: vecSpecialKeyPressed[GLUT_KEY_UP] = true; break; } if (key_pressed == GLUT_KEY_F1) glutFullScreenToggle(); }
void keyboard_handler (unsigned char key, int x, int y) { switch (key) { case '\x1b': /* Escape */ case 'q': case 'Q': glutLeaveMainLoop (); break; case 'f': /* fullscreen */ case 'F': glutFullScreenToggle (); break; default: break; } }
void glut_wrapper::keyboard(unsigned char key, int x, int y) { switch(key) { case 27: glutExit(); exit(0); break; case '.': glutFullScreenToggle(); break; default: if (glut_wrapper::manager != nullptr) { glut_wrapper::manager->dispatchKeyboardInput(key); } break; } }
void specialHandler(int key, int x, int y) { switch (key) { case GLUT_KEY_LEFT: keys.key_left = true; break; case GLUT_KEY_RIGHT: keys.key_right = true; break; case GLUT_KEY_UP: keys.key_up = true; break; case GLUT_KEY_DOWN: keys.key_down = true; break; case GLUT_KEY_END: exit(1); break; case GLUT_KEY_F11: glutFullScreenToggle(); break; } }
void Menu(int value) { switch (value) { case(0) : // "Quit" selected on the menu glutLeaveMainLoop(); break; case(1) : // Toggle full screen glutFullScreenToggle(); break; default: cout << "Invalid view selection " << endl; } // Signal GLUT to call display callback glutPostRedisplay(); } // end viewMenu
void glut_keyboard(unsigned char key, int x, int y) { switch(key) { case 27: //Cleanup(); glutExit(); exit(0); break; case '.': if(!quality_measurement_mode_enabled_) glutFullScreenToggle(); break; default: if (management_ != nullptr) { management_->dispatchKeyboardInput(key); } break; } }
// Responds to 'f' and escape keys. 'f' key allows // toggling full screen viewing. Escape key ends the // program. Allows lights to be individually turned on and off. static void KeyboardCB(unsigned char key, int x, int y) { switch (key) { case('f') : case('F') : // 'f' key to toggle full screen glutFullScreenToggle(); break; case(27) : // Escape key glutLeaveMainLoop(); break; case('w') : // "forward" key // TODO zTrans = zTrans + 1.0f; break; case('s') : // "back" key // TODO zTrans = zTrans - 1.0f; break; default: cout << key << " key pressed." << endl; } // Set the viewing transformation based on the values held in the global varaiables zTrans, // rotationX, and rotationY. glm::mat4 transView = glm::translate(glm::vec3(0.0f, 0.0f, zTrans)); glm::mat4 rotateViewX = glm::rotate(glm::radians(rotationX), glm::vec3(1.0f, 0.0f, 0.0f)); glm::mat4 rotateViewY = glm::rotate(glm::radians(rotationY), glm::vec3(0.0f, 1.0f, 0.0f)); viewingTransformation = transView * rotateViewX * rotateViewY; glutPostRedisplay(); } // end KeyboardCB
/* GL/GLUT stuff */ void keyPressed (unsigned char key, int x, int y) { printf("%c\n",key); if(key == 'f') { #ifdef __FREEGLUT_STD_H__ glutFullScreenToggle(); #else if( glutGet(GLUT_WINDOW_WIDTH) == glutGet(GLUT_SCREEN_WIDTH) && glutGet(GLUT_WINDOW_HEIGHT) == glutGet(GLUT_SCREEN_HEIGHT) && glutGet(GLUT_WINDOW_X) == 0 && glutGet(GLUT_WINDOW_Y) == 0 ) { glutReshapeWindow(oldwidth,oldheight); } else { glutFullScreen(); } #endif } if(key == 'q') { #ifdef __FREEGLUT_STD_H__ glutLeaveMainLoop(); #else exit(0);// lol #endif } if(key == '+') { steps *= STEP; } if(key == '-') { steps /= STEP; if(steps < 1) steps = 1; } if(key == '\x1e') { // glutLeaveFullScreen(); } }
static void TW_CALL toggle_fullscreen_callback( void * ) { glutFullScreenToggle(); }
void Window::Fullscreen () { glutFullScreenToggle (); log (LOG_INFO, "Toogle between fullscreen and windowed mode"); }
/** * Function that listens for event input from keyboard. */ void Keyboard(unsigned char key, int x, int y) { switch (key){ /*projection commands*/ case '1': printf("changing projection to orthographic.\n"); orthographic(); break; case '2': printf("changing projection to oblique.\n"); oblique(); break; case '3': printf("changing projection to perspective.\n"); perspective(); break; /*camera movement*/ case 'm': printf("Camera movement. You can no use w,a,s,d,z,x to move "); printf("around.\n"); currentMode = 'm'; glutPostRedisplay(); break; case 'w': if(useSmooth == true){ useSmooth = false; bezSpeed += 0.25; calculateNewBezierCurve(direction,P0,Pref,V0,bezierP,PrefChange,uM, uMPrim,bezSpeed); bezierPCounter = 0; useSmooth = true; }else{ cameraForward(0); } break; case 'a': if(useSmooth == true){ direction = 'l'; calculateNewBezierCurve(direction,P0,Pref,V0,bezierP,PrefChange,uM, uMPrim,bezSpeed); bezierPCounter = 0; }else{ cameraLeft(); } break; case 's': if(useSmooth == true){ if(bezSpeed > 0.5){ useSmooth = false; bezSpeed -= 0.25; calculateNewBezierCurve(direction,P0,Pref,V0,bezierP,PrefChange, uM,uMPrim,bezSpeed); bezierPCounter = 0; useSmooth = true; } }else{ cameraBackward(); } break; case 'd': if(useSmooth == true){ direction = 'r'; calculateNewBezierCurve(direction,P0,Pref,V0,bezierP,PrefChange,uM, uMPrim,bezSpeed); bezierPCounter = 0; }else{ cameraRight(); } break; /*object movement*/ case 'q': printf("Closing program.....\n"); exit(0); break; case 'v': glutFullScreenToggle(); break; case 'o': printf("\ncurrent mode: open OFF file.\n"); currentMode = 'o'; glutPostRedisplay(); loadVertices(NULL); glutPostRedisplay(); break; case 't': printf("current mode: translation.\n"); currentMode = 't'; chosenMovement = 'n'; chosenMovement = 'n'; glutPostRedisplay(); printf("In which direction (x,y or z) do you want to move the object?"); printf("\npress x,y or z button to choose.\n"); break; case 'e': printf("current mode: Scaling.\n"); currentMode = 's'; glutPostRedisplay(); chosenMovement = 'n'; chosenMovement = 'n'; printf("press + or - button to scale the object.\n"); break; case 'r': printf("current mode: Rotating.\n"); currentMode = 'r'; glutPostRedisplay(); chosenMovement = 'n'; chosenMovement = 'n'; printf("Press x,y,or z to choose which axis the object should "); printf("rotate around.\n"); break; case 'x': if(currentMode == 't'){ printf("X direction chosen. press + or - button "); printf("to move the object.\n"); chosenDirection = 'x'; }else if(currentMode == 'r'){ printf("X direction chosen. press + or - button "); printf("to rotate the object around the X-axis.\n"); chosenDirection = 'x'; }else{ cameraUp(); } break; case 'y': if(currentMode == 't'){ printf("Y direction chosen. press + or - button "); printf("to move the object.\n"); chosenDirection = 'y'; }else if(currentMode == 'r'){ printf("Y direction chosen. press + or - button "); printf("to rotate the object around the Y-axis.\n"); chosenDirection = 'y'; } break; case 'z': if(currentMode == 't'){ printf("Z direction chosen. press + or - button "); printf("to move the object.\n"); chosenDirection = 'z'; } else if(currentMode == 'r'){ printf("Z direction chosen. press + or - button "); printf("to rotate the object around the Z-axis.\n"); chosenDirection = 'z'; }else{ cameraDown(); } break; case '+': if(currentMode == 't'){ if(chosenDirection == 'x' || chosenDirection == 'y' || chosenDirection == 'z'){ chosenMovement = '+'; translateStage(); } }else if(currentMode == 's'){ chosenMovement = '+'; scaleStage(); }else if(currentMode == 'r'){ chosenMovement = '+'; rotateStage(); } break; case '-': if(currentMode == 't'){ if(chosenDirection == 'x' || chosenDirection == 'y' || chosenDirection == 'z'){ chosenMovement = '-'; translateStage(); } }else if(currentMode == 's'){ chosenMovement = '-'; scaleStage(); }else if(currentMode == 'r'){ chosenMovement = '-'; rotateStage(); } break; case 'f': /*changes between line mode and filled mode for the object.*/ if(objectFilled == false){ glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); sendTMatrixToGPU(); glutPostRedisplay(); objectFilled = true; }else if(objectFilled == true){ glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); sendTMatrixToGPU(); glutPostRedisplay(); objectFilled = false; } break; case 'h': printf("Help:\n----------------------------------------------------\n"); printf("The allowed keyboard commands are: \n"); printf("o: open file, q: quit program, t: transform object\n"); printf("e: scale object, r: rotate object, m: camera movement.\n"); printf("f: object fill: on/off "); printf("x: choose x-axis. If camera mode: go up.\ny: choose y-axis "); printf("z: choose z-axis. If camera mode: go down.\n\n"); printf("w: move camera forward. a: move camera left.\n"); printf("s: move camera backwards. d: move camera right.\n"); printf("v: toggle between fullscreenmode..\n"); printf("1: orthographic projection. 2: oblique projection.\n"); printf("3: perspective projection.\n"); printf("You may also use the mouse to move the camera. To enable, "); printf("press and hold left\nmouse button and move the mouse.\n"); printf("Use the mouseScroll to zoom in or out.\n"); printf("-----------------------------------------------------------\n"); break; default: printf("Unknown keyboard command. Press \"h\" for help. \n"); break; } }
int main(int argc, char** argv) { namespace po = boost::program_options; namespace fs = boost::filesystem; const std::string exec_name = (argc > 0) ? fs::basename(argv[0]) : ""; scm::shared_ptr<scm::core> scm_core(new scm::core(1, argv)); putenv((char *)"__GL_SYNC_TO_VBLANK=0"); int window_width; int window_height; unsigned int main_memory_budget; unsigned int video_memory_budget ; unsigned int max_upload_budget; std::string resource_file_path = ""; std::string measurement_file_path = ""; bool measurement_file_interpolation = false; float measurement_interpolation_stepsize = 1.0f; std::string pvs_file_path = ""; bool pvs_culling = true; po::options_description desc("Usage: " + exec_name + " [OPTION]... INPUT\n\n" "Allowed Options"); desc.add_options() ("help", "print help message") ("width,w", po::value<int>(&window_width)->default_value(1920), "specify window width (default=1920)") ("height,h", po::value<int>(&window_height)->default_value(1080), "specify window height (default=1080)") ("resource-file,f", po::value<std::string>(&resource_file_path), "specify resource input-file") ("vram,v", po::value<unsigned>(&video_memory_budget)->default_value(2048), "specify graphics memory budget in MB (default=2048)") ("mem,m", po::value<unsigned>(&main_memory_budget)->default_value(4096), "specify main memory budget in MB (default=4096)") ("upload,u", po::value<unsigned>(&max_upload_budget)->default_value(64), "specify maximum video memory upload budget per frame in MB (default=64)") ("measurement-file", po::value<std::string>(&measurement_file_path)->default_value(""), "specify camera session for quality measurement_file (default = \"\")") ("measurement-interpolate", po::value<bool>(&measurement_file_interpolation)->default_value(false), "allow interpolation between measurement transformations (default=false)") ("measurement-stepsize", po::value<float>(&measurement_interpolation_stepsize)->default_value(1.0f), "if interpolation is activated, this will be the stepsize in spatial units between interpolation points") ("pvs-file,p", po::value<std::string>(&pvs_file_path), "specify potentially visible set file.") ("pvs-culling", po::value<bool>(&pvs_culling)->default_value(true), "pvs will optimize drawn level of detail, yet if pvs culling is set to true, potentially occluded geometry will not be renderer"); ; po::positional_options_description p; po::variables_map vm; try { auto parsed_options = po::command_line_parser(argc, argv).options(desc).allow_unregistered().run(); po::store(parsed_options, vm); po::notify(vm); std::vector<std::string> to_pass_further = po::collect_unrecognized(parsed_options.options, po::include_positional); bool no_input = !vm.count("input") && to_pass_further.empty(); if (resource_file_path == "") { if (vm.count("help") || no_input) { std::cout << desc; return 0; } } // no explicit input -> use unknown options if (!vm.count("input") && resource_file_path == "") { resource_file_path = "auto_generated.rsc"; std::fstream ofstr(resource_file_path, std::ios::out); if (ofstr.good()) { for (auto argument : to_pass_further) { ofstr << argument << std::endl; } } else { throw std::runtime_error("Cannot open file"); } ofstr.close(); } } catch (std::exception& e) { std::cout << "Warning: No input file specified. \n" << desc; return 0; } // set min and max window_width = std::max(std::min(window_width, 4096), 1); window_height = std::max(std::min(window_height, 2160), 1); main_memory_budget = std::max(int(main_memory_budget), 1); video_memory_budget = std::max(int(video_memory_budget), 1); max_upload_budget = std::max(int(max_upload_budget), 64); initialize_glut(argc, argv, window_width, window_height); std::pair< std::vector<std::string>, std::vector<scm::math::mat4f> > model_attributes; std::set<lamure::model_t> visible_set; std::set<lamure::model_t> invisible_set; model_attributes = read_model_string(resource_file_path, &visible_set, &invisible_set); //std::string scene_name; //create_scene_name_from_vector(model_attributes.first, scene_name); std::vector<scm::math::mat4f> & model_transformations = model_attributes.second; std::vector<std::string> const& model_filenames = model_attributes.first; lamure::ren::policy* policy = lamure::ren::policy::get_instance(); policy->set_max_upload_budget_in_mb(max_upload_budget); //8 policy->set_render_budget_in_mb(video_memory_budget); //2048 policy->set_out_of_core_budget_in_mb(main_memory_budget); //4096, 8192 policy->set_window_width(window_width); policy->set_window_height(window_height); lamure::ren::model_database* database = lamure::ren::model_database::get_instance(); std::vector<scm::math::mat4d> parsed_views = std::vector<scm::math::mat4d>(); std::string measurement_filename = ""; snapshot_session_descriptor measurement_descriptor; if( ! measurement_file_path.empty() ) { measurement_descriptor.recorded_view_vector_ = parse_camera_session_file(measurement_file_path); measurement_descriptor.snapshot_resolution_ = scm::math::vec2ui(window_width, window_height); size_t last_dot_in_filename_pos = measurement_file_path.find_last_of('.'); size_t first_slash_before_filename_pos = measurement_file_path.find_last_of("/\\", last_dot_in_filename_pos); measurement_descriptor.session_filename_ = measurement_file_path.substr(first_slash_before_filename_pos+1, last_dot_in_filename_pos); quality_measurement_mode_enabled_ = true; measurement_descriptor.snapshot_session_enabled_ = true; glutFullScreenToggle(); } management_ = new management(model_filenames, model_transformations, visible_set, invisible_set, measurement_descriptor); management_->interpolate_between_measurement_transforms(measurement_file_interpolation); management_->set_interpolation_step_size(measurement_interpolation_stepsize); management_->enable_culling(pvs_culling); // PVS basic setup. If no path is given, runtime access to the PVS will always return true (visible). if(pvs_file_path != "") { std::string pvs_grid_file_path = pvs_file_path; pvs_grid_file_path.resize(pvs_grid_file_path.length() - 3); pvs_grid_file_path = pvs_grid_file_path + "grid"; lamure::pvs::pvs_database* pvs = lamure::pvs::pvs_database::get_instance(); pvs->load_pvs_from_file(pvs_grid_file_path, pvs_file_path, false); } // Start rendering main loop. glutMainLoop(); if (management_ != nullptr) { delete lamure::ren::cut_database::get_instance(); delete lamure::ren::controller::get_instance(); delete lamure::ren::model_database::get_instance(); delete lamure::ren::policy::get_instance(); delete lamure::ren::ooc_cache::get_instance(); } return 0; }
void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) { switch (cChar) { case 27: glutLeaveMainLoop(); break; case 'f': case 'F': printf("main window toggle fullscreen\n"); glutFullScreenToggle(); break; case 'r': case 'R': if (nChildWindow!=-1 && cChar=='r') /* Capital R always resizes the main window*/ { glutSetWindow(nChildWindow); printf("child window resize\n"); if (!bChildSizeDone) glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)+50,glutGet(GLUT_WINDOW_HEIGHT)+50); else glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)-50,glutGet(GLUT_WINDOW_HEIGHT)-50); bChildSizeDone = !bChildSizeDone; } else { glutSetWindow(nWindow); printf("main window resize\n"); if (glutGet(GLUT_WINDOW_WIDTH)<400) glutReshapeWindow(600,300); else glutReshapeWindow(300,300); } break; case 'm': case 'M': if (nChildWindow!=-1 && cChar=='m') /* Capital M always moves the main window*/ { glutSetWindow(nChildWindow); /* The window position you request is relative to the top-left * corner of the client area of the parent window. */ if (!bChildPosDone) glutPositionWindow(glutGet(GLUT_WINDOW_X)+50,glutGet(GLUT_WINDOW_Y)+50); else glutPositionWindow(glutGet(GLUT_WINDOW_X)-50,glutGet(GLUT_WINDOW_Y)-50); bChildPosDone = !bChildPosDone; } else { glutSetWindow(nWindow); printf("main window position\n"); /* The window position you request is the outer top-left of the window, * the client area is at a different position if the window has borders * and/or a title bar. */ if (glutGet(GLUT_WINDOW_X)<400) glutPositionWindow(600,300); else glutPositionWindow(300,300); } break; case 'd': case 'D': if (nChildWindow!=-1 && cChar=='d') /* Capital D always moves+resizes the main window*/ { glutSetWindow(nChildWindow); if (!bChildPosDone) glutPositionWindow(glutGet(GLUT_WINDOW_X)+50,glutGet(GLUT_WINDOW_Y)+50); else glutPositionWindow(glutGet(GLUT_WINDOW_X)-50,glutGet(GLUT_WINDOW_Y)-50); bChildPosDone = !bChildPosDone; if (!bChildSizeDone) glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)+50,glutGet(GLUT_WINDOW_HEIGHT)+50); else glutReshapeWindow(glutGet(GLUT_WINDOW_WIDTH)-50,glutGet(GLUT_WINDOW_HEIGHT)-50); bChildSizeDone = !bChildSizeDone; } else { if (glutGet(GLUT_WINDOW_X)<400) glutPositionWindow(600,300); else glutPositionWindow(300,300); if (glutGet(GLUT_WINDOW_WIDTH)<400) glutReshapeWindow(600,300); else glutReshapeWindow(300,300); } break; case 'c': case 'C': if (nChildWindow==-1) { int width = glutGet(GLUT_WINDOW_WIDTH); int height = glutGet(GLUT_WINDOW_HEIGHT); /* open child window */ printf("open child window\n"); nChildWindow = glutCreateSubWindow(nWindow,(int)(width*.35),(int)(height*.35),(int)(width*.3),(int)(height*.3)); glutKeyboardFunc( SampleKeyboard ); glutDisplayFunc( Redisplay ); glutReshapeFunc( Reshape ); glutPositionFunc( Position ); glutWindowStatusFunc( WindowStatus ); } else { /* close child window */ printf("close child window\n"); glutSetWindow(nWindow); glutDestroyWindow(nChildWindow); nChildWindow = -1; bChildSizeDone = GL_FALSE; bChildPosDone = GL_FALSE; } break; case 'i': case 'I': glutIconifyWindow(); glutTimerFunc(1500, ChangeTitleTimer, 0); break; case 'h': case 'H': if (nChildWindow!=-1 && cChar=='h') /* Capital H always hides the main window*/ { glutSetWindow(nChildWindow); glutTimerFunc(2000, UnhideTimer, nChildWindow); } else { glutSetWindow(nWindow); glutTimerFunc(2000, UnhideTimer, nWindow); } glutHideWindow(); break; case 'p': case 'P': if (nChildWindow!=-1 && cChar=='p') /* Capital P always changes pointer for the main window*/ { glutSetWindow(nChildWindow); if (glutGet(GLUT_WINDOW_CURSOR)==GLUT_CURSOR_TOP_SIDE) glutSetCursor(GLUT_CURSOR_RIGHT_ARROW); else glutSetCursor(GLUT_CURSOR_TOP_SIDE); } else { glutSetWindow(nWindow); if (glutGet(GLUT_WINDOW_CURSOR)==GLUT_CURSOR_CYCLE) glutSetCursor(GLUT_CURSOR_RIGHT_ARROW); else glutSetCursor(GLUT_CURSOR_CYCLE); } break; default: break; } }
void ToggleFullScreenMode() /*****************************************************************************/ { glutFullScreenToggle(); }