Smooth Rendering

Hello Everyone.
i am building a small game.It has a simple target that keeps moving.i used filled circles as the
target.

This is the code for the circles that i used:

/* Draw 5 Filled Circles at random positions */
	for(i = 0; i < 5; i++) {
		glBegin(GL_POLYGON);
		glColor3fv(Color[COLOR++]);	/* Take color from color array */

		/* Draw a circle whicn is filled */
		for(j = 0; j < 360; j += 10) {
			float temp1 = rad * sin(j * (3.14 / 180.0));
			float temp2 = rad * cos(j * (3.14 / 180.0));
			
			glVertex2d(CentreX + temp1, temp2 + CentreY);
		}
		glEnd();
		rad -= 25;
	}
	glFlush();

But im not getting a smooth rendering.The circles are jagged.Is there any way i can give a smooth
rendering?
i enabled GL_POLYGON_SMOOTH.But it is still a little jagged.

IS there any way i can further improve it?Can anyone please help?

Thanks in advance.

  1. Enable multisampling
  2. Use more edges (step size < 10 degrees)
  3. Use blend alpha or multisample alpha to feather the edges

You’re never really going to get perfectly smooth circles this way, as 3D applications work in triangles.

What you need is to use a texture of a filled circle. Make the texture all white, have the alpha channel handle the circle outline, and GL_MODULATE it with the colour you want to use. Each circle can then be drawn with a single quad which will give you better overall performance too.

You don’t even need to load an image from disc for this, you can generate the texture image procedurally in code to a memory buffer and upload it (using glTexImage2D) from there.

Hi all,
I have a big circle, inside which I need to draw numerous small circles. I draw all the circles with black outline and without shading.

I tried a few ways which worked to get the outer big circle to be smooth.

  1. I used GL_LINE_LOOP to join the points and enables GL_LINE_SMOOTH with alpha blending. I got a smooth outer circle.

I tried the same with the inner circles which are very small. But I see that when I do bleding, the outline of the circles are very very dull and spongy. But when I zoom in the inner circles, I see they look exactly like the outer circles. But when they are small, they are spongy.

I don’t exactly understand what “mhagain” is explaining. It seems when I do a texture mapping, I can get good results. Can someone explain me what that means and also direct me to sources where I could learn about creating 2D textures. All I could find was loading a .bmp file as texture.

Any help would be highly apprecialted.

Thanks in advance
ATN