Want more features on Pastebin? Sign Up, it's FREE!
Guest

Init Code

By: a guest on Aug 12th, 2012  |  syntax: C++  |  size: 1.18 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
  2.         fprintf(stderr,"%s:%d\n    SDL_Init call failed.\n",__FILE__,__LINE__);
  3.         return false;
  4.     }
  5.  
  6.     // Request use of the stencil buffer
  7.     SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 );
  8.  
  9.     if((Surf_Display = SDL_SetVideoMode(WWIDTH, WHEIGHT, 32,  SDL_GL_DOUBLEBUFFER | SDL_OPENGL | SDL_RESIZABLE)) == NULL) {
  10.         fprintf(stderr,"%s:%d\n    SDL_SetVideoMode call failed.\n",__FILE__,__LINE__);
  11.         return false;
  12.     }
  13.  
  14.  
  15.     // Init GLDebug system
  16.     GLDebug::Init();
  17.  
  18.     // Init GL system
  19.     glClearColor(0, 0, 0, 1);
  20.  
  21.     glClearDepth(1.0f);
  22.  
  23.     glViewport(0, 0, WWIDTH, WHEIGHT);
  24.  
  25.     glMatrixMode(GL_PROJECTION);
  26.  
  27.     glLoadIdentity();
  28.  
  29.     glOrtho(0, WWIDTH,  WHEIGHT, 0, 1, -1);
  30.  
  31.     glMatrixMode(GL_MODELVIEW);
  32.  
  33.     //glHint(GL_POINT_SMOOTH, GL_NICEST);
  34.     glHint(GL_LINE_SMOOTH, GL_NICEST);
  35.     glHint(GL_POLYGON_SMOOTH, GL_NICEST);
  36.  
  37.     //glEnable(GL_POINT_SMOOTH);
  38.     glEnable(GL_LINE_SMOOTH);
  39.     glEnable(GL_POLYGON_SMOOTH);
  40.  
  41.     glLoadIdentity();
  42.  
  43.     SDL_EnableKeyRepeat(1, SDL_DEFAULT_REPEAT_INTERVAL / 3);
  44.  
  45.     CAppStateManager::SetActiveAppState(APPSTATE_INTRO);
  46.     return true;
clone this paste RAW Paste Data