10 static const float PI = 3.1415926535897;
12 /// ***** Private Method Headers *****
17 /// ***** Public Methods *****
25 void graphicsCleanUp()
30 void glDrawCircle(float radius, const Vector2& vec, const float* color)
32 glMatrixMode(GL_MODELVIEW);
34 glTranslatef(vec.x, vec.y, -1);
35 glScalef(radius, radius, radius);
43 /// ***** Private Methods *****
45 void drawCircle(int pieces)
48 for(int n = 0; n < pieces; n++)
50 float angle = 2 * PI * n / pieces;
51 float ix = cos(angle);
52 float iy = sin(angle);
54 glVertex3f(ix, iy, 0);
61 if(SDL_Init(SDL_INIT_VIDEO) < 0)
63 cerr << "SDL_Init failed: " << SDL_GetError() << endl;
67 // In order to use SDL_OPENGLBLIT we have to
68 // set GL attributes first
69 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 8);
70 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
72 if(SDL_SetVideoMode(800, 600, 16, SDL_OPENGL) < 0)
74 cerr << "SDL_SetVideoMode failed: " << SDL_GetError() << endl;
81 glClearColor(0.0, 0.0, 0.0, 0.0);
83 glMatrixMode(GL_PROJECTION);
86 glOrtho(0, 800.0, 600.0, 0.0, -0.01, 1.01);
88 glMatrixMode(GL_MODELVIEW);
91 glEnable(GL_DEPTH_TEST);