Computer Graphics Assignment
Computer Graphics Assignment
void init(void) {
glClearColor(1.0, 1.0, 1.0, 0.0); // Set background color to white
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, 300.0, 0.0, 300.0); // Set orthographic projection (adjust as needed)
}
float x = x1;
float y = y1;
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
if (dx < 0) {
dx = -dx;
incx = -1;
}
if (dy < 0) {
dy = -dy;
incy = -1;
}
int x = x1;
int y = y1;
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}