1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
void drawcircle(float x, float y)
{
float angle = 0;
float r = 0.2;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); // reset transformations
glEnable(GL_COLOR_MATERIAL); //Enable color
gluLookAt(0.0f, 0.0f, 10.0f,0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
glColor3f (1.0f, 1.0f, 1.0f);
float delta_theta = 0.01;
glTranslatef(x,y,0);
glBegin( GL_POLYGON ); // OR GL_LINE_LOOP
for (angle = 0; angle < 2*PI; angle += delta_theta )
{
glColor3f (1.0f, 1.0f, 1.0f);
glVertex3f( r*cos(angle), r*sin(angle), 0 );
}
glEnd();
glutSwapBuffers();
}
|