int main(int argc, char** argv) { std::cout <<"'W'moves up 'S' moves down \n"; std::cout <<"'a' move left, 'd' moves right \n"; std::cout <<"If you hit the rocks, the program will shut down"; std::cout <<"Press L to turn on the light\n"; std::cout <<"Have fun .\n"; glutInit(&argc, argv); /*---------------------------------Main Window---------------------------------------*/ glutInitWindowSize(600, 600); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("Space Helicoptor PRO"); glEnable(GL_DEPTH_TEST); speed += 0.1; //setup the initial view // change to projection matrix mode, set the extents of our viewing volume glMatrixMode(GL_PROJECTION); glLoadIdentity(); //glOrtho(-2.5, 2.5, -2.5, 2.5, -2.5, 2.5); gluPerspective (75,1,2,5000); //set clear colour to white //glClearColor(1, 1, 1, 0); //register glut callbacks for keyboard and display function glutKeyboardFunc(kbd); // glutSpecialFunc(special); glutSpecialFunc(pressKey); // here are the new entries glutIgnoreKeyRepeat(1); glutSpecialUpFunc(releaseKey); glutTimerFunc(25, motion, 0); glutDisplayFunc(display); glutMainLoop(); return 0; }
void menu(int value) { switch(value) { case 1: glutIgnoreKeyRepeat(1); break; case 2: glutIgnoreKeyRepeat(0); break; case 3: glutKeyboardFunc(NULL); break; case 4: glutKeyboardFunc(key); break; case 5: glutKeyboardUpFunc(NULL); break; case 6: glutKeyboardUpFunc(keyup); break; case 7: glutSpecialFunc(NULL); break; case 8: glutSpecialFunc(special); break; case 9: glutSpecialUpFunc(NULL); break; case 10: glutSpecialUpFunc(specialup); break; } }
/***************************************************************************//** * @author Daniel Andrus, Johnny Ackerman * * @par Description: Begins running the program. Initializes OpenGL, registers * events, instantiates objects, and runs the game. Beware when * calling this function, as it enters the OpenGL main loop, only * to return at end of program execution. * * @returns Status code of the program. 0 means no problems. *******************************************************************************/ int Fractals::run( int argc, char *argv[] ) { window_width = (int) view_width; window_height = (int) view_height; // perform various OpenGL initializations glutInit( &argc, argv ); // Put window in center of screen int w = glutGet(GLUT_SCREEN_WIDTH); int h = glutGet(GLUT_SCREEN_HEIGHT); if (w != 0 && h != 0) { w = w / 2 - window_width / 2; h = h / 2 - window_height / 2; } // Initialize glut with 32-bit graphics, double buffering, and anti-aliasing glutInitDisplayMode( GLUT_RGBA /*| GLUT_DOUBLE*/ | GLUT_MULTISAMPLE ); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Set up the program window glutInitWindowSize( window_width, window_height); // initial window size glutInitWindowPosition( w, h ); // initial window position glutCreateWindow( window_name.c_str() ); // window title // Always clear screen to black glClearColor( 1.0, 1.0, 1.0, 1.0 ); glutIgnoreKeyRepeat(1); // Register callbacks glutDisplayFunc( *::display ); glutReshapeFunc( *::reshape ); glutMouseFunc( *::mouseclick ); glutMotionFunc( *::mousedrag ); glutPassiveMotionFunc( *::mousemove ); tabs[0]->active = true; switchView("Fractal"); // Go into OpenGL/GLUT main loop glutMainLoop(); return 0; }
int main(int argc, char **argv) { // Use a custom memory allocator FbxSetMallocHandler(MyMemoryAllocator::MyMalloc); FbxSetReallocHandler(MyMemoryAllocator::MyRealloc); FbxSetFreeHandler(MyMemoryAllocator::MyFree); FbxSetCallocHandler(MyMemoryAllocator::MyCalloc); // init GLUT and create window glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(800,600); glutCreateWindow("FBX Loading"); // Initialize OpenGL. const bool lSupportVBO = InitializeOpenGL(); // FbxString lFilePath("zombii.FBX"); // FbxString lFilePath("soldier.FBX"); FbxString lFilePath("Anteater_FBX.fbx"); // FbxString lFilePath("Turtle_FBX.fbx"); gSceneContext = new FBXLoader(lFilePath, 800, 600); init(); // register callbacks glutDisplayFunc(renderScene); glutReshapeFunc(changeSize); glutIdleFunc(renderScene); glutIgnoreKeyRepeat(1); glutKeyboardFunc(processNormalKeys); glutSpecialFunc(pressKey); glutSpecialUpFunc(releaseKey); // here are the two new functions glutMouseFunc(mouseButton); glutMotionFunc(mouseMove); // OpenGL init glEnable(GL_DEPTH_TEST); // enter GLUT event processing cycle glutMainLoop(); return 1; }
/* * void main(int argc, char **argv); * * Simply sets up the OpenGL framework, calls functions to set up and begin * the animation. */ int main(int argc, char **argv) { glutInit(&argc,argv); glutInitWindowSize(1600,900); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); window = glutCreateWindow("Sphere Collisions"); //window title glutDisplayFunc(display); glutIdleFunc(animate); // call animate() when idle glutIgnoreKeyRepeat(1); glutKeyboardFunc(keystroke); //handles user input glutKeyboardUpFunc(key_release); glutMouseFunc(mouse_button); glutMotionFunc(mouse_move); gfxinit(); glutMainLoop(); // start the animation }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitWindowSize(400, 400); glutCreateWindow("Proyecto"); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(keyboard); glutKeyboardUpFunc(keyboardup); glutIgnoreKeyRepeat(1); Init(); glutMainLoop(); return 0; }
/* * General main function. */ int main(int argc, char **argv) { isJumping = 0; falling = 0; base = eye[1]; max = base + JUMP_HEIGHT; srand(time(NULL)); //Randomizes the locations of the trees for (int i = 0; i < TREE_COUNT; ++i) { tree_x[i] = rand()%1152/24.0 - 24.0; } for (int i = 0; i < TREE_COUNT; ++i) { tree_z[i] = rand()%1152/24.0 - 24.0; } // Randomizes the color of the tree's leaves for (int i = 0; i < TREE_COUNT; ++i) { tree_c[i] = 0.15 + rand()%7500/7500.0; } glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(WINDOW_SIZE, WINDOW_SIZE); glutCreateWindow("Assignment #5 - Forest"); //callBacks glutKeyboardFunc(myKeyboard); glutKeyboardUpFunc(myKeyboardUp); glutReshapeFunc(myReshape); glutDisplayFunc(display); glutIdleFunc(idle); glutIgnoreKeyRepeat(1); glEnable(GL_DEPTH_TEST); glutMainLoop(); return 0; }
/****************************************************************************** * Function: main( int argc, char *argv[] ) * Authors: Ian Carlson, Christopher Smith * Description: Start of the Pong game that creates the limits for all objects * ****************************************************************************/ int main( int argc, char *argv[] ) { //limits for all game objects so they stay on screen left_paddle.set_limits(0,TOTAL_WIDTH/2.0,BOTTOM_COURT_EDGE, TOP_COURT_EDGE); right_paddle.set_limits(TOTAL_WIDTH/2.0,TOTAL_WIDTH,BOTTOM_COURT_EDGE, TOP_COURT_EDGE); ball.set_limits(-ball.get_radius(),TOTAL_WIDTH+ball.get_radius(),BOTTOM_COURT_EDGE,TOP_COURT_EDGE); // perform various OpenGL initializations glutInit( &argc, argv ); initOpenGL(); glutIgnoreKeyRepeat(1);//ignore auto repeats from held keys // go into OpenGL/GLUT main loop, never to return glutMainLoop(); // yeah I know, but it keeps compilers from bitching return 0; }
int main(int argc, char** argv) { glutInit(&argc, argv); // couches du framebuffer utilisees par l'application glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); // position et taille de la fenetre glutInitWindowPosition(20, 80); glutInitWindowSize(W_fen,H_fen); glutCreateWindow(argv[0]); // Windows only exposes OpenGL 1.1 functions. // To call more modern functions, we need to load GLEW. #if defined(_WIN32) GLenum err = glewInit(); (GLEW_OK != err) ? printf("GLEW init failed!\n") : printf("GLEW init complete\n"); #endif init( ); // Initialize viewpoint glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0,0,-4); tbInitTransform(); tbHelp(); // cablage des callback glutReshapeFunc(reshape); glutIgnoreKeyRepeat(1); glutKeyboardFunc(keyboard); //call *once* on keydown glutKeyboardUpFunc(keyboardUp); glutDisplayFunc(displayInternal); glutMouseFunc(mouse); glutMotionFunc(mouseMotion); // traqueboule utilise la souris glutPassiveMotionFunc(mousePassiveMotion); glutIdleFunc(animate); glutTimerFunc(firstEnemySpawnDelay, spawnEnemy, 0); glutTimerFunc(bossSpawnDelay, spawnBoss, 0); // lancement de la boucle principale glutMainLoop(); return 0; // instruction jamais exécutée }
void initGLUT(int* argc, char** argv) { glutInit(argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowPosition(WINDOW_X, WINDOW_Y); glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT); glutCreateWindow("Test"); glutDisplayFunc(displayFrame); glutIdleFunc(nextFrame); glutReshapeFunc(changeSize); glutSpecialFunc(keypressWrapper); glutSpecialUpFunc(keypressUpWrapper); glutKeyboardFunc(keypressWrapper); glutIgnoreKeyRepeat(1); }
int main( int argc, char **argv ) { int f=1; if(argc != 2) { printf(MSG_USAGE); f=0; } else if(f && readLorenzDataFile(argv[1],&lorenzData) == ERRORISDGL) { if(DEBUG) printf(MSG_ERROR_IO); showErrorGL(MSG_ERROR_IO); f=0; } if(!f) defaultLorenzValues(&lorenzData); maxiters = lorenzData.maxiters; scheme = lorenzData.scheme; style = lorenzData.style; points = malloc(sizeof(Point)*maxiters); glutInit(&argc,argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(width,height); glutInitWindowPosition(POSITION_X,POSITION_Y); windowID = glutCreateWindow(WINDOW_TITLE); glutGameModeString("1280x800:32@60"); glutEnterGameMode(); initializeGL(); glutIgnoreKeyRepeat(1); glutKeyboardFunc(&keyPressedGL); glutSpecialFunc(&specialKeyPressedGL); glutSpecialUpFunc(releaseKeyGL); glutDisplayFunc(drawGL); glutReshapeFunc(reshapeGL); glutTimerFunc(20, timerGL, 1); glutMainLoop(); return EXIT_SUCCESS; }
int main(int argc, char **argv){ forceField = FALSE; initShip(); initCenario(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(900, 900); glutCreateWindow("Nave"); init(); glutDisplayFunc(draw); glutTimerFunc(100, timeStep, 1); glutIgnoreKeyRepeat(TRUE); glutKeyboardFunc(keydown); glutKeyboardUpFunc(keyup); glutMainLoop(); return 0; }
void init() { glutKeyboardFunc(normalKeyboard); glutSpecialFunc(specialKeyboard); glutIgnoreKeyRepeat(0); glutSpecialUpFunc(releaseKey); glutMouseFunc(mouseClick); glutMotionFunc(mouseActive); //glutPassiveMotionFunc(mousePassive); // init Menus createPopupMenus(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); }
int main( int argc, char** argv ) { // Initialize glut glutInit(&argc,argv); // Initialize display (RGBA has alpha channel glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); // -1 -1 automatic positioning glutInitWindowPosition(0, 0); // Window position (from top corner), and size (width and hieght) // i want 16:9 "cinema" like glutInitWindowSize( 1600, 900); // window name glutCreateWindow("SVDRV_as02"); // Initialize OpenGL initRendering(); // Inizialize Model and Inizialize Texture ###MUST BE AFTER INIT RENDERING!!!### initModel(); // Set up callback // Handles "normal" ascii symbols glutKeyboardFunc(handleKeypress); // Handles other key (not used) // glutSpecialFunc(handleSpecialKeypress); glutIgnoreKeyRepeat(GL_TRUE); glutSpecialFunc(pressKey); glutSpecialUpFunc(releaseKey); // mouse handling glutMouseFunc(mouseButton); glutMotionFunc(mouseMove); // called in case of resize glutReshapeFunc(changeSize); // call this whenever window needs redrawing glutDisplayFunc(drawScene); // call function during execution (to not use glutPostRedisplay();) glutIdleFunc(idleScene); // start main loop fprintf(stdout, "Press esc to exit\n"); glutMainLoop(); return(0); // This line is never reached. }
//----------------------------------------------------------------// void _AKUOpenWindowFunc ( const char* title, int width, int height ) { sWinX = 180; sWinY = 100; sWinWidth = width; sWinHeight = height; sWinWidth = width; sWinHeight = height; if ( !sHasWindow ) { glutInitDisplayMode ( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH ); glutInitWindowSize ( sWinWidth, sWinHeight ); glutInitWindowPosition ( sWinX, sWinY ); glutCreateWindow ( title ); sHasWindow = true; } glutIgnoreKeyRepeat ( 1 ); glutKeyboardFunc ( _onKeyDown ); glutKeyboardUpFunc ( _onKeyUp ); glutSpecialFunc ( _onSpecialDown ); glutSpecialUpFunc ( _onSpecialUp ); glutMouseFunc ( _onMouseButton ); glutMotionFunc ( _onMouseDrag ); glutPassiveMotionFunc ( _onMouseMove ); glutDisplayFunc ( _onPaint ); glutReshapeFunc ( _onReshape ); AKUDetectGfxContext (); AKUSetScreenSize ( width, height ); #ifdef __APPLE__ GLint sync = 1; CGLContextObj ctx = CGLGetCurrentContext(); CGLSetParameter (ctx, kCGLCPSwapInterval, &sync); #endif }
int main(int argc, char *argv[]){ const char* windowTitle = "DEI - Editor"; WS.reset(); KP.reset(); MOUSE_DIFF.z=0;MOUSE_DIFF.x=0;MOUSE_DIFF._prevX=-1;MOUSE_DIFF._prevZ=-1;MOUSE_DIFF._numberEvents=0; OBSERVER.position.init(0,200,200); OBSERVER.lookingAt.init(0,0,0); OBSERVER.up.init(0,1,0); EDITOR_OBJECTS = allocateEditorObject(); EDITOR_OBJECT_NUMBER_OBJECTS = loadEditorObjectFileWithFileName(EDITOR_OBJECTS,EDITOR_FILE_NAME); if(EDITOR_OBJECT_NUMBER_OBJECTS!=-1){ printf("Loaded %d editor objects\n",EDITOR_OBJECT_NUMBER_OBJECTS); }else{ printf("Error loading editor objects %s\n",EDITOR_FILE_NAME); } glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(WS.xInitialWindowPosition,WS.yInitialWindowPosition); glutInitWindowSize(WS.screenWidth,WS.screenHeight); glutCreateWindow(windowTitle); glutDisplayFunc(mainDisplayLoopCallback); glutReshapeFunc(resizeWindowCallback); glutIgnoreKeyRepeat(1); glutKeyboardFunc(keyboardDownCallback); glutKeyboardUpFunc(keyboardUpCallback); glutSpecialFunc(keyboardSpecialDownCallback); glutSpecialUpFunc(keyboardSpecialUpCallback); glutMotionFunc(mouseMotionCallback); glutMouseFunc(mouseCallback); glutPassiveMotionFunc(mousePassiveCallback); glClearColor(0.1,0.1,0,0); glutMainLoop(); return 0; }
/////////////////////////////////////////////////////////////////////////////// // entry point int main(int argc, char **argv) { // init GLUT glutInit(&argc, argv); // use depth buffer, double buffering and standard RGBA mode glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(200,200); // standard resolution: glutInitWindowSize(640, 480); // title: glutCreateWindow("<add title>"); // set callbacks: glutIgnoreKeyRepeat(1); glutKeyboardFunc(ProcessNormalKeys); glutSpecialFunc(PressSpecialKey); glutSpecialUpFunc(ReleaseSpecialKey); glutMouseFunc(ProcessMouse); glutMotionFunc(ProcessMouseMotion); glutDisplayFunc(RenderScene); glutIdleFunc(Idle); glutReshapeFunc(ChangeSize); // init OpenGL extensions (like shader support, framebuffer object, etc) if (utInitOpenGL20() == false) return 1; // init whole application: if (InitApp() == false) { utLOG_ERROR("cannot init application..."); return 1; } // start rendering and animation: glutMainLoop(); // finish: CleanUp(); return(0); }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize (500, 500); glutInitWindowPosition (100, 100); glutCreateWindow (argv[0]); glutFullScreen(); init (); glutDisplayFunc(display); glutReshapeFunc(reshape); glutSpecialFunc(pressKey); // here are the new entries glutIgnoreKeyRepeat(1); glutSpecialUpFunc(releaseKey); glutKeyboardFunc(keyboard); glutIdleFunc(display); glutMainLoop(); return 0; }
/** * The main function. */ int main(int argc, char *argv[]) { //Set up the window glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); GW = 1080; GH = 720; glutInitWindowSize(GW, GH); glutInitWindowPosition(300, 50); glutCreateWindow("Particle System"); glClearColor(0.0, 0.0, 0.0, 1.0); glutPassiveMotionFunc( mouseMove ); glutDisplayFunc( display ); glutReshapeFunc( reshape ); glutKeyboardFunc ( keyboard ); glutKeyboardUpFunc ( keyboardUp ); glutIgnoreKeyRepeat(1); initScene(); glutMainLoop(); }
void initWindow(void) { glutIgnoreKeyRepeat(1); glutDisplayFunc(display); glutVisibilityFunc(visible); glutKeyboardFunc(key); glutKeyboardUpFunc(keyup); glutSpecialFunc(special); glutSpecialUpFunc(specialup); glutJoystickFunc(joystick, 100); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, MAX_X, 0, MAX_Y, 0, MAX_Y); glMatrixMode(GL_MODELVIEW); glPointSize(3.0); currentWindow = glutGetWindow(); }
int main(int argc,char*args[]) { glutInit(&argc,args); glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(SCREEN_WIDTH,SCREEN_HEIGHT); glutCreateWindow("GLUT Starter - by Philip R Simonson"); glutDisplayFunc(&display); glutIdleFunc(&update); glutReshapeFunc(&resizeDisplay); glutIgnoreKeyRepeat(1); glutKeyboardFunc(&processKeys); glutSpecialFunc(&processSpecial); glutSpecialUpFunc(&processSpecialUp); glutMainLoop(); return 1; }
void initializeGLWindow(int argc, char **argv, int _w, int _h) { glutInit(&argc, argv); // Initializes glut // Sets up a double buffer with RGBA components and a depth component glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA | GLUT_MULTISAMPLE #ifdef __APPLE__ | GLUT_3_2_CORE_PROFILE #endif ); glutInitWindowSize(w = _w, h = _h); // Sets the window position to the upper left glutInitWindowPosition(0, 0); // Creates a window using internal glut functionality glutCreateWindow("Flightsim"); #ifdef __linux__ glewExperimental = GL_TRUE; glewInit(); #endif #ifdef __MINGW32__ glewExperimental = GL_TRUE; glewInit(); #endif std::printf("%s\n%s\n", glGetString(GL_RENDERER), // e.g. Intel HD Graphics 3000 OpenGL Engine glGetString(GL_VERSION) // e.g. 3.2 INTEL-8.0.61 ); // passes reshape and display functions to the OpenGL machine for callback glutReshapeFunc(reshape); glutIgnoreKeyRepeat(1); glutSetCursor(GLUT_CURSOR_NONE); }
/** * Register the GLUT-Callback-routines. */ void registerCallBacks (void) { glutMotionFunc(cbMouseMotion); glutMouseFunc (cbMouseButton); /* Timer-Callback */ glutTimerFunc (1000 / TIMER_CALLS_PS, cbTimer, glutGet (GLUT_ELAPSED_TIME)); glutReshapeFunc (cbReshape); glutDisplayFunc (cbDisplay); glutKeyboardFunc (cbKeyboard); glutSpecialFunc (cbSpecial); glutIgnoreKeyRepeat (1); }
int main(int argc,char** argv) { glutInit(&argc,argv); init(); glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutKeyboardUpFunc(KeyUp); glutSpecialFunc(SpecialFunction); glutIgnoreKeyRepeat(true); Timer->start(); last_time=Timer->time(); walkTimer = Timer->time(); LoadImages(); CreateObjects(); CreateWorld(); glutMainLoop(); return 0; }
int main(int argc, char *argv[]) { //FreeConsole(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowSize(512, 288); //glutGameModeString( "1366x768:32@60" ); //glutEnterGameMode(); glutCreateWindow("let's start"); glutIgnoreKeyRepeat(true); Init(); //glutFullScreen(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(KeyboardDown); glutKeyboardUpFunc(KeyboarUp); glutMouseFunc(Mouse); glutMotionFunc(MouseMotion); glutTimerFunc(50,Time,0); glutMainLoop(); }
Game::Game() : univers(), simulator(&univers) { glClearColor(BACKGROUND_COLOR); #ifdef FULLSCREEN glutFullScreen(); #endif setSimulator(&simulator); setUnivers(&univers); Vvector pos(0, 0, 0); Vvector addx(10, 0, 0); Vvector addy(0, 10, 0); for (int i = 0; i < 48; i++) { for (int j = 0; j < 48; j++) { this->univers.addPlanet("Torus", pos); pos += addx; } pos = Vvector(0, pos.y() + addy.y(), pos.z()); } { glutIgnoreKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); glutTimerFunc(KEY_REPEAT_PERIOD, keyboard, 0); } { glutReshapeFunc(windowResizingHandler); glutWindowStatusFunc(windowStatusHandler); #ifdef __APPLE__ glutWMCloseFunc(windowClosingHandler); #endif glutDisplayFunc(displayHandler); } }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitWindowPosition(100, 100); glutInitWindowSize(960, 600); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutCreateWindow("Blasteroids"); glutDisplayFunc(renderScene); glutReshapeFunc(changeSize); glutIgnoreKeyRepeat(1); glutKeyboardFunc(processNormalKeys); glutSpecialFunc(processSpecialKeys); glutSpecialUpFunc(processSpecialUpKeys); srand(time(NULL)); setup_data(); r = random_roid(); CURRENT_TIME = glutGet(GLUT_ELAPSED_TIME); glutMainLoop(); return 0; }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(320,320); glutCreateWindow("OpenGL Lab 02-2"); glutDisplayFunc(renderScene); glutReshapeFunc(changeSize); glutIdleFunc(renderScene); glutIgnoreKeyRepeat(1); glutKeyboardFunc(processNormalKeys); glutSpecialFunc(pressKey); glutSpecialUpFunc(releaseKey); glutMouseFunc(mouseButton); glutMotionFunc(mouseMove); glEnable(GL_DEPTH_TEST); glutMainLoop(); return 0; }
/* * General main function. */ int main(int argc, char **argv) { // Initalizes the states for each of the lights // to be true so they all start on. state_1 = 1; state_2 = 1; state_3 = 1; state_4 = 1; state_5 = 1; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(WINDOW_SIZE, WINDOW_SIZE); glutCreateWindow("Assignment #6 - Lighting with Wormy"); //callBacks glutKeyboardFunc(myKeyboard); glutReshapeFunc(myReshape); glutDisplayFunc(display); glutIdleFunc(idle); glutKeyboardUpFunc(myKeyboardUp); glutIgnoreKeyRepeat(1); //Sets up light and locations light_setup(); glEnable(GL_DEPTH_TEST); glutMainLoop(); return 0; }
void init(const char *title) { int argc = 0; glutInit(&argc, NULL); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowPosition(-1, -1); glutInitWindowSize(w, h); glutCreateWindow(title); glutSetCursor(GLUT_CURSOR_INHERIT); glutIgnoreKeyRepeat(1); initFramebuffer(); initProgram(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(goKeyboard); glutKeyboardUpFunc(goKeyboardUp); glutSpecialFunc(goSpecial); glutSpecialUpFunc(goSpecialUp); glutMotionFunc(goMotion); glutPassiveMotionFunc(goMotion); glutMouseFunc(goMouse); glutEntryFunc(goEntry); glutVisibilityFunc(visible); glClearColor(1.0f, 1.0f, 1.0f, 0.0f); goReady(); glutMainLoop(); glDeleteTextures(1, &fbo_texture); glDeleteFramebuffers(1, &fbo); glDeleteProgram(program); }