Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/gl.h>
- #include <GL/glut.h>
- int r, p, i,decision,x, y, Dx, Dy;
- void display(void)
- {
- x=0, y=r;
- decision= (5/4)-r;
- while (y > x)
- {
- glColor3f(1.0,1.0,0.0);
- glBegin(GL_POINTS);
- if (decision < 0)
- {
- x++;
- decision += 2*x+1;
- }
- else
- {
- y--;
- x++;
- decision += 2*(x-y)+1;
- }
- glVertex2d(x, y);
- glVertex2d(x, -y);
- glVertex2d(-x, y);
- glVertex2d(-x, -y);
- glVertex2d(y, x);
- glVertex2d(-y, x);
- glVertex2d(y, -x);
- glVertex2d(-y, -x);
- }
- glEnd();
- glFlush();
- }
- void init (void)
- {
- glClearColor (0.0, 0.0, 0.0, 0.0);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluOrtho2D(-500, 500, -500, 600);
- }
- int main(int argc, char** argv)
- {
- printf("Enter redius \n");
- scanf("%d", &r);
- glutInit(&argc, argv);
- glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
- glutInitWindowSize (500, 500);
- glutInitWindowPosition (100, 100);
- glutCreateWindow ("Sumon's Circle Drawing");
- init ();
- glutDisplayFunc(display);
- glutMainLoop();
- return 0; /* ISO C requires main to return int. */
- }
Add Comment
Please, Sign In to add comment