Sign in to follow this  
asdfwe

colour fill help

Recommended Posts

can u please tell the modification required in this code to fill colour in the circle made................

glBegin(GL_LINES);
for ( float angle =0; angle <=2*3.142; angle+=3.142/30)
{

float x1=(radius * cos (angle) / 2) ;
float y1=(radius * sin (angle) / 2) ;
float x2=(radius * cos (angle + 3.142/30) / 2 ;
float y2=(radius * sin (angle + 3.142/30)/ 2) ;
glVertex2f(x1,y1);
glVertex2f(x2,y2);
}
glEnd();

Share this post


Link to post
Share on other sites
Changing your code as little as possible, I get this:
glBegin(GL_TRIANGLE_FAN);
glVertex2f(0,0);
for ( float angle =0; angle <=2*3.142; angle+=3.142/30)
{
float x1=(radius * cos (angle) / 2) ;
float y1=(radius * sin (angle) / 2) ;
glVertex2f(x1,y1);
}
glVertex2f(radius * cos (angle) / 2, radius * sin (angle) / 2);
glEnd();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this