This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 14th, 2013  |  syntax: C  |  size: 0.70 KB  |  views: 43  |  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. #include <tchar.h>
  2. #include <SDL.h>
  3. #include <SDL_syswm.h>
  4. #include <gl/GL.h>
  5.  
  6. #pragma comment (lib , "sdl.lib")
  7. #pragma comment (lib , "opengl32.lib")
  8.  
  9. int _tmain(int argc, _TCHAR* argv[])
  10. {
  11.   SDL_Surface * surf = NULL;
  12.  
  13.   if (SDL_Init(SDL_INIT_VIDEO) < 0)
  14.     return 0;
  15.  
  16.   SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
  17.  
  18.   if ((surf = SDL_SetVideoMode(800, 600, 32, SDL_OPENGL)) == NULL)
  19.     return 0;
  20.  
  21.   glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
  22.  
  23.   while(true)
  24.   {
  25.     SDL_Event Event;
  26.     while(SDL_PollEvent(&Event))
  27.     {
  28.       if(Event.type == SDL_QUIT)
  29.         return 0;
  30.     }
  31.  
  32.     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  33.     SDL_GL_SwapBuffers();
  34.   };
  35.  
  36.   return 0;
  37. }
clone this paste RAW Paste Data