void DDA_line(int x0, int y0, int x1, int y1,int color)
{
int dx = x1 – x0, dy = y1 – y0, k;
float xIncrement , yIncrement ,steps, x = x0, y = y0;
if (fabs (dx) > fabs (dy)) steps = fabs (dx);
else steps = fabs (dy);
xIncrement = (float) (dx) /steps;
yIncrement = (float) (dy) /steps;
For (k =0; k<steps; k++){
Putpixel(round(x), round(y),color);
x += xIncrement; y += yIncrement;
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
void init()
{
glClearColor(0.0f,0.0f,1.0f,1.0f);
}
void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow(“hello”);
glutDisplayFunc(display);
init();
glutMainLoop();
}
{
int dx = x1 – x0, dy = y1 – y0, k;
float xIncrement , yIncrement ,steps, x = x0, y = y0;
if (fabs (dx) > fabs (dy)) steps = fabs (dx);
else steps = fabs (dy);
xIncrement = (float) (dx) /steps;
yIncrement = (float) (dy) /steps;
For (k =0; k<steps; k++){
Putpixel(round(x), round(y),color);
x += xIncrement; y += yIncrement;
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
void init()
{
glClearColor(0.0f,0.0f,1.0f,1.0f);
}
void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow(“hello”);
glutDisplayFunc(display);
init();
glutMainLoop();
}










