Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1.     //Initialise SDL.
  2.     if(SDL_Init(SDL_INIT_VIDEO) < 0) exit(1);
  3.  
  4.     //Use double buffering (24-bit).
  5.     SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
  6.     SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
  7.  
  8.     //Create window.
  9.     if (SDL_SetVideoMode(1000, 1000, 32, SDL_OPENGL) == 0) exit(1);
  10.     SDL_WM_SetCaption("cp22g08 Coursework 1", "cp22g08 Coursework 1");
  11.  
  12.     //Set up orthographic camera.
  13.     glMatrixMode(GL_PROJECTION);
  14.  
  15.     glLoadIdentity();
  16.  
  17.     glOrtho(-2, 2, -2, 2, 2, -2);
  18.  
  19.     glMatrixMode(GL_MODELVIEW);
  20.  
  21.     //Set the clear color.
  22.     glClearColor(0, 0, 0, 1);
  23.  
  24.     //Use the z-buffer.
  25.     glEnable(GL_DEPTH_TEST);
  26.  
  27.     //Use vertex and colour arrays.
  28.     glEnableClientState(GL_VERTEX_ARRAY);
  29.     glEnableClientState(GL_COLOR_ARRAY);
  30.  
  31.     //Calculate the vertex and colour data.
  32.     calculateV();
  33.     calculateC();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement