I've been trying to render a torus (in 2D) in OpenGL and Well, I think I'm on the right track but I thought I'd ask you how to go about getting it to work. here's the code:
// attempting to create a torus (in 2D)
void createRing(double radius,
double radius2,
int numSegments,
double x,
double y)
{
double mAngle = 0.0;
double mAngle2 = 0.0;
glBegin(GL_POLYGON);
for(int i = 0; i < numSegments; i++)
{
mAngle = i * (2 * 3.14/numSegments);
mAngle2 = i * (2 * 3.14/numSegments);
glVertex2d(x + radius * cosf(mAngle), y + radius * sinf(mAngle));
glVertex2d(x + (radius + radius2 * cosf(mAngle2)) * cosf(mAngle2),
y + (radius + radius2 * sinf(mAngle2)) * sinf(mAngle2));
}
glEnd();
}
now here's the polygon this produces:
please let me know if there's anything I need to do to fix this.