Advertisement
Guest User

Untitled

a guest
Feb 14th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement