Part I: Simple interactive drawing:
Develop an OpenGL program that allow a user to draw a circle in a position of the OpenGL window by clicking the left button of a mouse. Furthermore, the program should allow the user to draw multiple circles. When the user is done with drawing, he/she can terminate the program by entering the ’q’ or ’Q’. Your code will need to maintain a data structure to record the position of each left-click of mouse. you can use a 2-dimensional array, and assume that the maximum number of left-click is 100. Each time, when there is a GLUT LEFT BUTTON event, your code should insert the current mouse position to the 2-dimensional array.
There are two different coordinate systems in this simple drawing. The mouse position is under the matrix coordinate system, and a vertex for drawing OpenGL geometry primitive is under the geometry coordinate system. So your code should transform the mouse position from matrix coordinate to geometry coordinate.
Further, allow users to erase a circle by clicking the right-button of a mouse
inside a drawn circle. So when there is a GLUT RIGHT BUTTON event, your code should perform a linear retrieval of the array of the left-click points to test whether the right-click point is inside the circle of a certain left-click points. If there is such a point, it should be removed from the array, then the rest of elements should be moved forward to the hole. Since it is possible that the drawn circles are overlapping and the right-click points are inside multiple circles, your code should search through the entire array and remove all “relevant” left-click points.
Part II: 2D Transformation:
Develop an OpenGL program that allow a user to perform 2D affine transformation, including translation, scaling, rotation, on a 2D object (e.g., a solid square), by selecting an transformation item from the popup menu. In this project, you can have two-layer menu as follows:
– Horizontal increment
– Horizontal decrement
– Vertical increment
– Vertical decrement
– Horizontal enlarging
– Horizontal shrinking
– Vertical enlarging
– Vertical shrinking
Your code will need to maintain several geometry parameters of an object, including horizontal and vertical translation, orientation, and scaling factors. You code should include a function (called menu), in which you should update the geometry parameters of the object.
The object should be “complicated”, i.e., a composition of at least 2 OpenGL geometry primitives.
The following parameters should be used for an individual 2D transformation:
• 5 pixels for horizontal increment/decrement
• 2 for horizontal enlarging, and 0.5 for horizontal shrinking
• 10◦ for a rotation
1. Explicitly construct a transformation matrix in order to perform a speci-
fied 2D transformation to the object. The transformation matrix is represented as a one-dimensional array in OpenGL that is used as a parameter for the OpenGL function glMultMatrix() to update the current transformation matrix.
2. Also, implement a simulation of moving the object. Specifically, the object
is moved around a circle track clockwise and be back to its original position. So it is basically a task of performing a sequence of translations on the object.
NOTE: Submit the source code and readme. The source code should be welldocumented, i.e., having good readability
7 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön
Hello, expert in OpenGL programming here. I can implement the required 2 parts for you (interactive drawing and 2d transformations). Thanks and let me know if you are interested to work with me, Paul