CG 4 Thprogram
CG 4 Thprogram
CG 4 Thprogram
#include <GL/glut.h>
#include <stdio.h>
glBegin(GL_POINTS);
glEnd();
Void midpointCircle() {
Int x = 0;
Int y = r;
Int d = 1 – r;
Plot(x, y);
While (x < y) {
If (d < 0) {
D += 2 * x + 3;
} else {
D += 2 * (x – y) + 5;
y--;
X++;
Plot(x, y);
glFlush();
Void display() {
glClear(GL_COLOR_BUFFER_BIT);
midpointCircle();
Void init() {
glPointSize(1.0);
Scanf(“%d”, &r);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(0, 0);
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;