void ReleaseSpecialKeyInput (int key, int x, int y) { switch (key) { // pressing F1 key makes the prpgram fullscreen, press F1 again to get back in windowed mode case GLUT_KEY_F1: fullscreen = !fullscreen; if (fullscreen) { glutFullScreen (); } else { glutLeaveFullScreen (glutGet (GLUT_INIT_WINDOW_X), glutGet (GLUT_INIT_WINDOW_Y), glutGet (GLUT_INIT_WINDOW_WIDTH), glutGet (GLUT_INIT_WINDOW_HEIGHT) ); } break; case GLUT_KEY_F2: break; case GLUT_KEY_F3: break; case GLUT_KEY_RIGHT: RKP = false; break; case GLUT_KEY_LEFT: LKP = false; break; case GLUT_KEY_UP: UKP = false; break; case GLUT_KEY_DOWN: DKP = false; break; default: break; } }
void EfeitoVisual::setFullScreen() { if (!fullscreen) { glutFullScreen(); } else { //Default values sizeX = FULLHD_ORTHO_X; sizeY = FULLHD_ORTHO_Y; glutReshapeWindow(sizeX, sizeY); pair<int, int> position = positionScreen("center"); glutInitWindowPosition(position.first, position.second); } fullscreen = !fullscreen; }
void specialKeyboard(int key, int x, int y) { if (key == GLUT_KEY_F1) { fullscreen = !fullscreen; if (fullscreen) glutFullScreen(); else { glutReshapeWindow(500, 500); glutPositionWindow(50, 50); } } }
//Funcoes para teclado (atribuicoes de teclas) void Teclado ( unsigned char key, int x, int y ) { //Fazer o predio subir e descer com W e S if(key == 119) { predioy += 1; } if(key == 115) { predioy -= 1; } //Limites minimo e maximo do predio if (predioy < 0) { predioy = 0; } if (predioy > 2) { predioy = 2; } //Tela cheia na tecla f if(key == 102) { glutFullScreen(); } //Redesenha o novo valor glutPostRedisplay(); //Sai ao se precionar a tecla esc if(key == 27) { exit(0); } }
void oak::Window::showFullScreen(bool fullscreen) { makeCurrent(); if (fullscreen) { getPos(&_lastX, &_lastY); getSize(&_lastWidth, &_lastHeight); glutFullScreen(); } else { setSize(_lastWidth, _lastHeight); setPos(_lastX, _lastY); } }
//Reshape function void myReshape(int w, int h) { if (w<600 || h<600) glutFullScreen(); glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLfloat r = (GLfloat)h / (GLfloat)w; if (w <= h) glOrtho(-5, 5, -5 * r, 5 * r, -10, 10); else glOrtho(-5 / r, 5 / r, -5, 5, -10, 10); glMatrixMode(GL_MODELVIEW); glutPostRedisplay(); }
bool Shell_setFullScreen(bool fullScreen) { if (fullScreen && !inFullScreenMode) { inFullScreenMode = true; configuration.windowX = glutGet(GLUT_WINDOW_X); configuration.windowY = glutGet(GLUT_WINDOW_Y); glutFullScreen(); } else if (!fullScreen && inFullScreenMode) { glutPositionWindow(configuration.windowX, configuration.windowY); glutReshapeWindow(configuration.windowWidth, configuration.windowHeight); inFullScreenMode = false; } return true; }
// Our Keyboard Handler For Special Keys (Like Arrow Keys And Function Keys) void special_keys(int a_keys, int x, int y) { switch (a_keys) { case GLUT_KEY_F1: // We Can Switch Between Windowed Mode And Fullscreen Mode Only if (!g_gamemode) { g_fullscreen = !g_fullscreen; // Toggle g_fullscreen Flag if (g_fullscreen) glutFullScreen(); // We Went In Fullscreen Mode else glutReshapeWindow(WCX, WCY); // We Went In Windowed Mode } break; default: break; } }
int main ( int argc, char** argv ) // Create Main Function For Bringing It All Together { glutInit ( &argc, argv ); // Erm Just Write It =) init (); glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE ); // Display Mode glutInitWindowSize ( 500, 500 ); // If glutFullScreen wasn't called this is the window size glutCreateWindow ( "NeHe's OpenGL Framework" ); // Window Title (argv[0] for current directory as title) glutFullScreen ( ); // Put Into Full Screen glutDisplayFunc ( display ); // Matching Earlier Functions To Their Counterparts glutReshapeFunc ( reshape ); glutIdleFunc ( idle ); glutKeyboardFunc ( keyboard ); glutSpecialFunc ( arrow_keys ); glutMainLoop ( ); // Initialize The Main Loop }
void menuSelect(int value) { switch (value) { // enable full screen display case OPTION_FULLSCREEN: glutFullScreen(); break; // reshape window to original size case OPTION_WINDOWDISPLAY: glutReshapeWindow(WINDOW_SIZE_W, WINDOW_SIZE_H); break; } }
void toggleFullScreenMode() { static int x = -1, y, w, h; if (x < 0) { x = glutGet(GLUT_WINDOW_X); y = glutGet(GLUT_WINDOW_Y); w = glutGet(GLUT_WINDOW_WIDTH); h = glutGet(GLUT_WINDOW_HEIGHT); glutFullScreen(); } else { glutPositionWindow(x, y); glutReshapeWindow(w, h); x = -1; } }
void keyboard(unsigned char key, int x, int y) { switch(key) { case 27: exit(0); break; case 'f': glutFullScreen(); break; case 'w': glutReshapeWindow(600, 600); break; } }
/* Main function: GLUT runs as a console application starting at main() */ int main(int argc, char** argv) { glutInit(&argc, argv); // Initialize GLUT glutInitDisplayMode(GLUT_DOUBLE); // Enable double buffered mode glutInitWindowSize(windowWidth, windowHeight); // Initial window width and height glutInitWindowPosition(windowPosX, windowPosY); // Initial window top-left corner (x, y) glutCreateWindow(title); // Create window with given title glutDisplayFunc(display); // Register callback handler for window re-paint glutReshapeFunc(reshape); // Register callback handler for window re-shape glutTimerFunc(0, Timer, 0); // First timer call immediately glutSpecialFunc(specialKeys); // Register callback handler for special-key event glutFullScreen(); // Put into full screen initGL(); // Our own OpenGL initialization glutMainLoop(); // Enter event-processing loop return 0; }
/////////////////////////////////////////////////////////////////////////// // Special Key-stroke Callback Function /////////////////////////////////// /////////////////////////////////////////////////////////////////////////// void Special(int key, int x, int y) { if(key == GLUT_KEY_F1) { _ScreenMode ++; if(_ScreenMode > 3) _ScreenMode=0; if(_ScreenMode == 0) glutReshapeWindow(200, 200); else if(_ScreenMode == 1) glutReshapeWindow(400, 400); else if(_ScreenMode == 2) glutReshapeWindow(600, 600); else if(_ScreenMode == 3) glutFullScreen(); } }
int main(int argc, char **argv) { /* Initialize GLUT state - glut will take any command line arguments that pertain to it or X Windows - look at its documentation at http://reality.sgi.com/mjk/spec3/spec3.html */ glutInit(&argc, argv); /* Select type of Display mode: Double buffer RGBA color Alpha components supported Depth buffered for automatic clipping */ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); /* get a 640 x 480 window */ glutInitWindowSize(640, 480); /* the window starts at the upper left corner of the screen */ glutInitWindowPosition(0, 0); /* Open a window */ window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99"); /* Register the function to do all our OpenGL drawing. */ glutDisplayFunc(&DrawGLScene); /* Go fullscreen. This is as soon as possible. */ glutFullScreen(); /* Even if there are no events, redraw our gl scene. */ glutIdleFunc(&DrawGLScene); /* Register the function called when our window is resized. */ glutReshapeFunc(&ReSizeGLScene); /* Register the function called when the keyboard is pressed. */ glutKeyboardFunc(&keyPressed); /* Initialize our window. */ InitGL(640, 480); /* Start Event Processing Engine */ glutMainLoop(); return 0; }
/** * @brief フルスクリーンにする関数 */ void fullscreen(){ int nMode = 0; DEVMODE devMode; HWND hWnd; hWnd = GetActiveWindow(); // 描画変更される if (Change) { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); while (EnumDisplaySettings(NULL, nMode++, &devMode)) { // 640×480をサポートしているか if (devMode.dmPelsWidth != X_SIZE || devMode.dmPelsHeight != Y_SIZE) continue; // 32ビットカラーをサポートしているか if (devMode.dmBitsPerPel != 32) continue; // テストして切り替えれるなら if (ChangeDisplaySettings(&devMode, CDS_TEST) == DISP_CHANGE_SUCCESSFUL) break; } ChangeDisplaySettings(&devMode, CDS_FULLSCREEN); glutFullScreen(); glViewport(0, 0, X_SIZE, Y_SIZE); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(30.4, (double)X_SIZE / (double)Y_SIZE, 0.1, 1000.0); glMatrixMode(GL_MODELVIEW); } else{ glClearColor(0.0f, 0.0f, 0.0f, 1.0f); ChangeDisplaySettings(NULL, 0); glutPositionWindow(100, 100); glutReshapeWindow(X_SIZE, Y_SIZE); glViewport(0, 0, X_SIZE, Y_SIZE); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(30.4, (double)X_SIZE / (double)Y_SIZE, 0.1, 1000.0); glMatrixMode(GL_MODELVIEW); } }
void setOther(int value) { switch (value) { case FULLSCREEN: glutFullScreen(); break; case FACENORMALS: drawFaceNorms = !drawFaceNorms; break; case ANTIALIAS: antialias = !antialias; if (antialias) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LINE_SMOOTH); glLineWidth(1.5); } else { glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); glLineWidth(1.0); } break; case ENVMAP: envMap = !envMap; if (envMap) { glBindTexture(GL_TEXTURE_2D, texId2); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); } else { glBindTexture(GL_TEXTURE_2D, texId1); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); } break; } glutPostRedisplay(); }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); glutInitWindowSize(640, 480); glutInitWindowPosition(0, 0); window = glutCreateWindow("Diamond"); glutDisplayFunc(&DrawGLScene); glutFullScreen(); glutIdleFunc(&DrawGLScene); glutReshapeFunc(&ReSizeGLScene); glutKeyboardFunc(&keyPressed); InitGL(1024, 768); glutMainLoop(); return 1; }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(1920, 1080); glutInitWindowPosition (100, 100); glutCreateWindow(argv[0]); glutFullScreen(); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutIdleFunc(animate); glutMainLoop(); return 0; }
// main function: GLUT runs as a console application int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(windowWidth, windowHeight); glutInitWindowPosition(windowPosX, windowPosY); glutCreateWindow(title); glutFullScreen(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutSpecialFunc(specialKey); glutIdleFunc(display); init(); glutMainLoop(); return 0; }
void fullscreen(){ int nMode = 0; DEVMODE devMode; HWND hWnd; hWnd = GetActiveWindow(); if(Change){ glClearColor( 1.0f, 1.0f, 0.0f, 1.0f ); ChangeDisplaySettings( &devMode, CDS_FULLSCREEN ); glutFullScreen(); }else{ glClearColor( 0.0f, 1.0f, 0.0f, 1.0f ); ChangeDisplaySettings(NULL, 0); glutPositionWindow(100,100); glutReshapeWindow(1280,800); } }
void menuCallback(int value) { switch (value) { case OPTION_FULLSCREEN: glutFullScreen(); break; case OPTION_WINDOWDISPLAY: glutReshapeWindow(512, 512); glutInitWindowPosition(0, 0); break; } glutPostRedisplay(); }
void keyboardFunc(unsigned char key, int x, int y) { if (keyBindings.find(key) != keyBindings.end()) { keyBindings[key](key, x, y); return; } key_pressed(key); switch (key) { case 'f' : if (g_fullscreen) { g_fullscreen = false; glutReshapeWindow(g_window_width,g_window_height); } else { g_fullscreen = true; g_window_width = g_width; g_window_height = g_height; glutFullScreen(); } break; case 'c' : { std::cout.precision(10); std::cout << "-vp " << g_camera.from.x << " " << g_camera.from.y << " " << g_camera.from.z << " " << "-vi " << g_camera.to.x << " " << g_camera.to.y << " " << g_camera.to.z << " " //<< "-vd " << g_camera.to.x-g_camera.from.x << " " << g_camera.to.y-g_camera.from.y << " " << g_camera.to.z-g_camera.from.z << " " << std::endl << "-vu " << g_camera.up.x << " " << g_camera.up.y << " " << g_camera.up.z << " " << "-fov " << g_camera.fov << std::endl; break; } //case 'a' : g_camera.rotate(-0.02f,0.0f); break; //case 'd' : g_camera.rotate(+0.02f,0.0f); break; //case 'w' : g_camera.move(0.0f,0.0f,+g_speed); break; //case 's' : g_camera.move(0.0f,0.0f,-g_speed); break; //case ' ' : g_display = !g_display; break; case '+' : g_debug=clamp(g_debug+0.01f); PRINT(g_debug); break; case '-' : g_debug=clamp(g_debug-0.01f); PRINT(g_debug); break; case '\033': case 'q': case 'Q': cleanup(); glutDestroyWindow(g_window); #if defined(__MACOSX__) exit(1); #endif break; } }
void main(int argc,char ** argv) { fp=fopen("gfile.dat","rb"); if(fp!='\0') { fread(&best_score,4,1,fp);vitoa(best_score,bstr); fclose(fp); } srand(20); srand(rand()); state[1]='6'; t[1][0]=140; t[1][1]=20; t[2][0]=120; t[2][1]=20; state[2]='6'; size=2; state2[1]='6'; t2[1][0]=140; t2[1][1]=660; t2[2][0]=120; t2[2][1]=660; state2[2]='6'; size2=2; glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE); glutInitWindowSize(1024,768); glutInitWindowPosition(0,0); glutCreateWindow("game"); glutDisplayFunc(display); glutMouseFunc(mouse); glutPassiveMotionFunc(passivemotion); glutSpecialFunc(spec_keys); glutKeyboardFunc(keyboard); glClearColor(0.3,0.2,0.6,1.0); init(); glutFullScreen(); glutMainLoop(); }
int main( int argc, char** argv ) { glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH|GLUT_MULTISAMPLE ); glutCreateWindow( "ch2_02_Init_Kinect" ); glutFullScreen(); glutIdleFunc( update ); glutDisplayFunc( render ); glutReshapeFunc( reshape ); glutKeyboardFunc( keyEvents ); if ( !initializeKinect() ) return 1; glutMainLoop(); destroyKinect(); return 0; }
int main(int argc, char **argv) { newGame(); // Initialize GLUT state glutInit(&argc, argv); // Select type of display mode: // Double buffer // RGBA color // Alpha components supported // Depth buffer glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); // Get a 640 x 480 window glutInitWindowSize(640, 480); // Window starts at the upper left corner of the screen glutInitWindowPosition(0, 0); // Open a window window = glutCreateWindow("glCube"); // Register the function to do the OpenGL drawing glutDisplayFunc(&DrawGLScene); // Go fullscreen glutFullScreen(); // Redraw the gl scene glutIdleFunc(&action); // Register the function called when the window is resized glutReshapeFunc(&ReSizeGLScene); // Register the function called when the keyboard is pressed glutKeyboardFunc(&keyPressed); glutSpecialFunc(specialPressed); // Initialize the window InitGL(640, 480); // Start event processing engine glutMainLoop(); return 1; }
void main (void) { FreeConsole(); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(1000,1000); glutInitWindowPosition(0, 0); glutCreateWindow("YAHOO!!!"); glEnable(GL_DEPTH_TEST); glClearColor(0, 0.5, 1, 1); glutKeyboardFunc(Keyboard); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutIdleFunc(Idle); glutFullScreen(); glutMainLoop(); getch(); }
int main(int argc, char **argv) { // We use the GLUT utility to initialize the window, to handle the input and to interact with the windows system glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(screen_width,screen_height); glutInitWindowPosition(0,0); glutCreateWindow("SpaceJump"); glutFullScreen(); glutDisplayFunc(display); glutReshapeFunc (resize); glutKeyboardFunc (keyboard); glutSpecialFunc (keyboard_s); mover(1); sky[0] = LoadTexBMP("planetcropped_scaled_trans.bmp"); texture[0] = LoadTexBMP("floor2.bmp"); texture[1] = LoadTexBMP("over.bmp"); texture[2] = LoadTexBMP("spacejump_start.bmp"); texture[3] = LoadTexBMP("brickwall.bmp"); // Initialize audio if (Mix_OpenAudio(44100,AUDIO_S16SYS,2,4096)) Fatal("Cannot initialize audio\n"); blt = Mix_LoadMUS("bullet.ogg"); if (!blt) Fatal("Cannot load bullet.ogg\n"); eng = Mix_LoadMUS("engine.ogg"); if (!eng) Fatal("Cannot load engine.ogg\n"); blast = Mix_LoadMUS("explosion.ogg"); if (!blast) Fatal("Cannot load explosion.ogg\n"); Init_star(); init(); width = glutGet(GLUT_WINDOW_WIDTH); height = glutGet(GLUT_WINDOW_HEIGHT); glutMainLoop(); return(0); }
void PtexViewer::toggleFullScreen() { static bool fullscreen = false; static int win[2]; if (!fullscreen) { win[0] = glutGet(GLUT_WINDOW_WIDTH); win[1] = glutGet(GLUT_WINDOW_HEIGHT); glutFullScreen(); fullscreen = true; } else { glutReshapeWindow(win[0],win[1]); fullscreen = false; } }
int start_openGL(int argc, char *argv[]) { glutInit(&argc, argv);// glut initialise something so that rendering will be enababled glutInitDisplayMode(GLUT_RGBA|GLUT_ALPHA|GLUT_DOUBLE|GLUT_DEPTH);// tell glut how to render output: rgba colorsm alpha channel, double buffers for smooth rendering, stores the depth in the render of polygons etc.. glutInitWindowSize(Environment::screen_width, Environment::screen_height); // sets the default window size glutCreateWindow("Maze Game Johannes and Marcus"); // create a window with a title // Extension wrangler initialising GLenum glew_status = glewInit(); // init the extension if (glew_status != GLEW_OK) { // if not success std::cerr << "Error: "<< glewGetErrorString(glew_status) << std::endl; // error msg return EXIT_FAILURE; } if (!GLEW_VERSION_2_0) { // if not right version std::cerr << "Error: your graphic card does not support OpenGL 2.0\n"; // error msg return 1; } // When all init functions runs without errors, // the program can initialise the resources if (init_resources() == 1) { // if we were able to init the resources // Go ahead and setup the opengl-Environment::game properties if(Environment::isFullscreen) // if fullscreen will show att start glutFullScreen();// set fullscreen on the window //glEnable(GL_CULL_FACE); // draw both sides of one face // glutSetCursor(GLUT_CURSOR_NONE);// make the cursor vanish glEnable(GL_BLEND); // make opengl blend-mode enabled glEnable(GL_DEPTH_TEST); // make opengl depth-test enabled glDisable(GL_CULL_FACE); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glutReshapeFunc(onReshape); // if the window resizes onReshape will be called glutIdleFunc(idle); // idle will be called every frame glutDisplayFunc(onDisplay); // onDisplay function will draw/update the screen vissually glutPassiveMotionFunc(onMouseMove);// onMouseMove is called when the mouse is moving glutMotionFunc(onMouseMove); // onMouseMove is called when the mouse is moving and mouse button is down glutKeyboardFunc(onKeyDown); // onKeyDown will be called when a key has ben pressed glutKeyboardUpFunc(onKeyUp); // onKeyUp will be called when a key has ben released glutSpecialFunc(onKeyDownSpecial); // special keys like F1,F2...F9 and arrows etc glutSpecialUpFunc(onKeyUpSpecial); glutMainLoop(); // starts the main program/the window that was created } return 0; }