11 /// ***** Private Method Headers *****
17 /// ***** Initializers/Cleaners *****
30 /// ***** Public Methods *****
32 void glDrawCircle(float radius, const Vector2& vec, const float* color)
34 glMatrixMode(GL_MODELVIEW);
36 glTranslatef(vec.x, vec.y, -1);
37 glScalef(radius, radius, radius);
45 /// ***** Private Methods *****
47 void drawCircle(int pieces)
50 for(int n = 0; n < pieces; n++)
52 float angle = 2 * PI * n / pieces;
53 float ix = cos(angle);
54 float iy = sin(angle);
56 glVertex3f(ix, iy, 0);
63 if(SDL_Init(SDL_INIT_VIDEO) < 0)
65 cerr << "SDL_Init failed: " << SDL_GetError() << endl;
69 // In order to use SDL_OPENGLBLIT we have to
70 // set GL attributes first
71 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 8);
72 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
74 if(SDL_SetVideoMode(800, 600, 16, SDL_OPENGL) < 0)
76 cerr << "SDL_SetVideoMode failed: " << SDL_GetError() << endl;
83 glClearColor(0.0, 0.0, 0.0, 0.0);
85 glMatrixMode(GL_PROJECTION);
88 glOrtho(0, 800.0, 600.0, 0.0, -0.01, 1.01);
90 glMatrixMode(GL_MODELVIEW);
93 glEnable(GL_DEPTH_TEST);