Second Assignment DDA algorithm for line drawing using Mouse
Draw the polygons by using the mouse. Choose colors by clicking on the designed color pane. Use window port to draw. (Use DDA algorithm for line drawing) #include<string.h> #include<GL/glut.h> #define ROUND(x)((int)(x+0.5)) struct Point { GLint x; GLint y; }; struct Color { GLfloat r; GLfloat g; GLfloat b; }; Color getPixelColor(GLint x, GLint y) //Fun for getting color of pixel { Color color; glReadPixels(x,y,1,1,GL_RGB, GL_FLOAT, &color); return color; } void setPixelColor(GLint x, GLint y, Color color) //set color of pixel { glColor3f(color.r, color.g, color.b); glBegin(GL_POINTS); glVertex2i(x,y); glEnd(); glFlush(); } void floodFill(GLint x, GLint y, Color oldColor, Color newColor)//seed fill algorithm { Color color; color= getPixelColor(x,y); if(color.r == oldColor.r && color.g == oldColor.g && color.b == oldColor.b) { setPixelColor(x,y, newColor); floodFill(x+1,y, oldColor, newColor); floodFill(x,y+1, oldCol...