Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Initialise SDL.
- if(SDL_Init(SDL_INIT_VIDEO) < 0) exit(1);
- //Use double buffering (24-bit).
- SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
- SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
- //Create window.
- if (SDL_SetVideoMode(1000, 1000, 32, SDL_OPENGL) == 0) exit(1);
- SDL_WM_SetCaption("cp22g08 Coursework 1", "cp22g08 Coursework 1");
- //Set up orthographic camera.
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-2, 2, -2, 2, 2, -2);
- glMatrixMode(GL_MODELVIEW);
- //Set the clear color.
- glClearColor(0, 0, 0, 1);
- //Use the z-buffer.
- glEnable(GL_DEPTH_TEST);
- //Use vertex and colour arrays.
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- //Calculate the vertex and colour data.
- calculateV();
- calculateC();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement