OpencL transformation functions OpenCl. maintains a 4xd transfomation matrix that is mulliplied by cvary (x,y,z) value seat wo glVeres0. This is somctimes refered to as the CT (cuncat transficemil The CT can be modifid by the following finctioes: - glMatriskoderal Modelview) - elloodldentitint - gitrandate f(x)(dx,dy,dz). - glfsale zfay sx, yy, ser. How to use the Qpengl- transformation functions There are two differen 4x4 matrics usod by Opengl. to produce an imape. They ate: - Progiction marix - wodel to "project" a 3D image onlo a 2 D pline lo creale an image: - Model Visw muarix - bedl to transform objects and the camera to ceate the desired seme asd vicw. Consunds like gfrandate. gliotute, and gtseale will medify the acthe matric in is the progranmer's respenobility to muke sare the apporpeiate mutrix is "active." The active maris is decenmined by calls 10g |MitrinMode0, such as: - glMatrixModerGl_PSOIECTONJ; /3 make the poojection mutric active 2) The trunsformations caned by giRotate, gitranslate, and plScale are applied to the CT fioumont transform). They will accumulate continually uniless yoe reser the nutrix back to the Identify matrix. If you want io start a new set of transformations, then call gll iadldentity 0 as in tee following example: vhMat a atbde (at MocktviEM) ? draucimerti (1) CCCS 255 Cumpier Gaptios draudbjact i): Programming Exercises 1. Open the anathed jrogran labe prukeml ofp 1. Set the werld cocedinates to be: - Ximin =6 - X Xnux =6 - Ymin=6 - Ymax -6 2. Create a rod square with the following covodinato: - Square - (1,1,0),(1,4,0),(5,4,0),(5,1,0) 3. Daw the x,y Coortinne lines in bluc. Ar this poinh, your program sheld display the followine: CCCS 325 Cocmuser Criphics arsuchject 2 6 ir Promramming Exarcises 1. Open the aftached programs lab6 jroblemlefp 1. Set the world cocrdinates to be: - X min =6 - Xmax=6 - YImin=6 - Y tax =6 2. Create a rod square with the following coondinates: - Square =(1,1,0),(1,4,0),(5,4,0),(5,1,0) 3. Draw the x, y Coordinate lines in blace. At this poiat, your prograns should display the following: 4. Implement interactive features that will translate the drawn square object with the LEFT, RIGiHT, UP or DOWNN amow kcys. for utilising the arrow keyx. 2. Take a look at the filet rotating. Cube eample cpp. the file contains the code to roate a cube based on moese input. Read the code, nun it, understand it. Modify your programs froen the previous question so that the square will continusesly rocute around the y-axis when the user presses the ' r ' key and sops rotation when the user preses the ' x ' hey. Your code for the keyboard function should look similur to