I am trying to draw a circle using GL_POLYGON
and the code I tried is working but the radius of the circle seems to be out of scale with the window size and I am not understanding why.
Here is the code:
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
if(start == OFF)
{
//Set Drawing Color - Will Remain this color until otherwise specified
glColor3f(0.2, 0.3, 0.5); //Some type of blue
//Draw Circle
glBegin(GL_POLYGON);
for(double i = 0; i < 2 * PI; i += PI / 24)
glVertex3f((cos(i) * radius) + gX,(sin(i) * radius) + gY, 0.0);
glEnd();
//Draw Circle
center_x = gX;
center_y = gY;
}
glutSwapBuffers();
}
and the init function:
void init (void)
{
/* selecionar cor de fundo (preto) */
glClearColor (0.0, 0.0, 0.0, 0.0);
/* inicializar sistema de viz. */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
I am setting the window size as 600 and the radius as 1 and a quarter of the circle takes us the whole window. I am guessing I have to do some kind of transformation with the radius, I just don't know how.