Friday, 6 September 2013

Circle not happening anywhere other than 0,0?

Circle not happening anywhere other than 0,0?

so this works fine if I make the origin (0,0) but here I am trying to make
it work at (20,20) and the shape isn't a circle at all. What is going on
here?
const unsigned int triangles = 20; // number of triangles
const float twoPi = 2.0f * 3.14159f;
const double radius = 0.1;
int i;
float delta = twoPi / triangles;
glBegin(GL_TRIANGLE_FAN);
glVertex2f(20/window_w,20/window_h); // origin
for(i = 0; i <= triangles; i++)
glVertex2f((20/window_w)+(radius * cos(i * delta)),
(20/window_h)+(radius * sin(i * delta)));
glEnd();

No comments:

Post a Comment