Answer the question
In order to leave comments, you need to log in
(C++, GLUT) Drawing a circle. What's causing the discrepancy between radius and position?
I use GLUT to draw 2D graphics.
I draw a circle:
double _tmpPoint;
glBegin(GL_TRIANGLE_FAN);
glVertex2f(posX, posY);
for( int i = 0; i <= radius; i++ )
{
_tmpPoint = (float)i / radius * 3.1415f * 2.0f;
glVertex2f(posX + cos(_tmpPoint) * (radius / 10),
posY + sin(_tmpPoint) * (radius / 10));
}
glEnd();
// Устанавливается не так, как надо
Ball->setPosition(Ball->getRadius(), Ball->getRadius());
//Устанавливается верно:
Ball->setPosition(Ball->getRadius() / 10, Ball->getRadius() / 10);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question