fill with color?

hello… i have drawn a circle and i want to fill it with color… how can i do it??

the code is the following:

#include <glut.h>
#include <math.h>

#define PI 3.14159
#define	circlePoints 256
int i;

void display()
{
	
	GLfloat angularStep=2*PI/(float)circlePoints;
	GLuint pointsPerQuadrant=circlePoints/4;
	
	GLfloat x[circlePoints];
	GLfloat y[circlePoints];
	
	GLfloat radius=20;


	
	glClearColor(0,0,0,0);
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(0,1,0);

	glLineWidth(3);

	//Defining the circle points
	for(i=0;i<pointsPerQuadrant/2;i++)
	{
		//Define points in first quadrant
		x[i]=radius*cos(i*angularStep);
		y[i]=radius*sin(i*angularStep);

		x[pointsPerQuadrant-1-i]=y[i];
		y[pointsPerQuadrant-1-i]=x[i];

		//Define points in second quadrant
		x[pointsPerQuadrant+i]=-y[i];
		y[pointsPerQuadrant+i]=x[i];

		x[2*pointsPerQuadrant-1-i]=-x[i];
		y[2*pointsPerQuadrant-1-i]=y[i];

		//Define points in third quadrant
		x[2*pointsPerQuadrant+i]=-x[i];
		y[2*pointsPerQuadrant+i]=-y[i];

		x[3*pointsPerQuadrant-1-i]=-y[i];
		y[3*pointsPerQuadrant-1-i]=-x[i];

		//Define points in fourth quadrant
		x[3*pointsPerQuadrant+i]=y[i];
		y[3*pointsPerQuadrant+i]=-x[i];

		x[4*pointsPerQuadrant-1-i]=x[i];
		y[4*pointsPerQuadrant-1-i]=-y[i];
	}

	//Connecting the circle points with lines
	glBegin(GL_LINE_LOOP);
	for (i=0;i<circlePoints;i++)
	{
		glVertex2f(x[i],y[i]);
	}
	glEnd();

	glFlush();
}

int main(int argc, char** argv)
{
	
	glutInit(&argc,argv);
	glutInitWindowPosition(50,50);
	glutInitWindowSize(640,480);
	glutInitDisplayMode(GLUT_SINGLE|GLUT_RGBA);
	glutCreateWindow("Circle drawing");

	glMatrixMode(GL_PROJECTION);
	gluOrtho2D(-32,32,-24,24);
	
	glutDisplayFunc(display);
	glutMainLoop();

	return 0;
}

i am using the LINE_LOOP and the cicle symmetry… i want only to fill it… plz dont give me alternative code, because the instruction of the project are very specific…

I can imagine that, homework projects often have very specific instructions :slight_smile:

Try something like GL_TRIANGLE_FAN instead of GL_LINE_LOOP.

thankssssssssss…exactly what i wanted:)