Drawing 2D crescent

I’m trying to draw a 2D crescent(a moon) but I’m facing a lot of problem. Here’s what I’ve been playing with so far, which have problems with the start and end vertices:

void drawCresent(float step, float radius, float cut) {
	float angle=0.0f;
	glColor4f(1.0, 1.0, 1.0, 1.0);
	while (angle<=PI) {
	while (angle<(2.0f*PI)) {
} [/b]

Unfortunately, because of the start and end points of the polygon are automatically joined, a straight line is being cut across the polygon and the colour filling of the area is incorrect. The inner curve of the crescent is lost because of the straight line.

I found this method really troublesome and not flexible because I have hardcoded the angles. I was thinking to use the intersection between 2 circles instead. Is it possible to remove an intersection area of a polygon in OpenGL? How can I do it? I’ve searched the web but have no answers to how I could remove intersected areas between polygons.

If removal of intersections is not possible or turns out to be more complicated, what else can I do to fix the problem in the above code?

Thanks for any help.

Check below link, hope this will help you…


Do you realize that this block of 3 lines has no effect on what gets drawn?
Comment it out and run your code, you’ll see what I mean.

Concerning your drawing issue, I think you have misdiagnosed the problem.
Change GL_POLYGON to GL_POINTS and run your code.
You’ll see that nothing is being overdrawn.
The code (as posted) is not generating an inner curve of vertices.
I recommend working in point mode until you’re sure the vertices of both
the inner and outer arc are being generated correctly.
Then, switch to POLY mode and worry about how to use the vertices to make polygons.