12 /// ***** Private Method Headers *****
14 void glDrawCircle(int);
18 /// ***** Initializers/Cleaners *****
26 void graphics::clean()
31 /// ***** Public Methods *****
33 void graphics::drawCircle(float radius, const Vector2& vec, const float* color)
35 glMatrixMode(GL_MODELVIEW);
37 glTranslatef(vec.x, vec.y, -1);
38 glScalef(radius, radius, radius);
46 /// ***** Private Methods *****
48 void glDrawCircle(int pieces)
51 for(int n = 0; n < pieces; n++)
53 float angle = 2 * PI * n / pieces;
54 float ix = cos(angle);
55 float iy = sin(angle);
57 glVertex3f(ix, iy, 0);
64 if(SDL_Init(SDL_INIT_VIDEO) < 0)
66 cerr << "SDL_Init failed: " << SDL_GetError() << endl;
70 // In order to use SDL_OPENGLBLIT we have to
71 // set GL attributes first
72 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 8);
73 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
75 if(SDL_SetVideoMode(800, 600, 16, SDL_OPENGL) < 0)
77 cerr << "SDL_SetVideoMode failed: " << SDL_GetError() << endl;
84 glClearColor(0.0, 0.0, 0.0, 0.0);
86 glMatrixMode(GL_PROJECTION);
89 glOrtho(0, 800.0, 600.0, 0.0, -0.01, 1.01);
91 glMatrixMode(GL_MODELVIEW);
94 glEnable(GL_DEPTH_TEST);