0

OpenGL GLUT

**My question is at the end of this topic**

```
1) a) Use your logo you drew within a world coordinate space that has 0,0 at the center. You may choose any width and height for your world coordinate space, glut window and viewport. Be sure that you separate this into a function. You may choose any size for your glut window. Additionally translate your logo so that it’s center is lined up at 0,0 and then uniformly scale down your logo using OpenGL so that it fits within a smaller space of your window. (you can also expand your world coordinate system to achieve this.)
2) Implement keyboard commands for:
• translation (left arrow= negative translation along x, right arrow=positive translation along x, up arrow= positive translation along y, down arrow= negative translation along y),
• rotation (- = negative rotation, + = positive rotation),
• scale (x= neg scale along x-axis, y= neg scale along y axis, u= neg uniform scaling,
X= pos scale along x-axis, Y= pos scale along y axis, U= pos uniform scaling), and
• Reset (Key “R” or “r” -> reset to original display – ie. clear the transformation matrix of all transformations)
All should increment by a value that remains constant, appropriate enough to see the transformation in one key press but not by too much or too little. You may need to experiment with this value a bit and this value may differ among transformation type: ie translation by 1 unit may be sufficient but rotation may need to be rotation by 5 degrees each time, etc. This value will be dependent upon your world coordinate system that you have chosen.
3) Implement OpenGL commands for translation, rotation, scale, and reset within the scene when the corresponding key is pressed. For Reset: The transformations should build upon one another and should only reset to original display if key “R” or “r” is pressed. HINT: All transformations are stored in the GL_Modelview matrix so setting the current matrix mode to be this and then calling glLoadIdentity() will replace the modelview matrix with the identity matrix which in turn will essentially clear all the transformations you added.
4) Implement push and pop for all transformations only using OpenGL commands. Keys “Page Down” should execute glPushMatrix(); and “Page Up” should execute glPopMatrix(); properly.
Optional: you may or may not choose to preserve aspect ratio.
5) Implement your own transformations using the matrices and multiplying the matrices we discussed. Keys “O” or “o” should switch to OpenGL mode and keys “M” or “m” should switch to your transformations mode.
6) Be sure to include implementation of a transformation stack similar to the one used for OpenGL. (don’t forget the reset!) No matter which display mode you are in you should, compute both such that when switching between modes, the object remains in the same configuration without change- this will enable you to test that your implementations are correct to how OpenGL is computing the transformations. HINT: just like glLoadIdentity() loads the identity matrix into the currentTransformation matrix, you can also load in any other matrix with void glLoadMatrixf(const GLfloat * m); but all matrix multiplications you will need to program on your own.
```

**I am unable to understand 4th point (i have called glpushmatrix and glpopmatrix in it) but how it is going to update my scene

and 6th point

i build own transformation matrices for translation, scaling and rotation

ans used glmultmatrix to multiply

but my sir wants me to not use glmultmatrix and multiply matrix manually

how i am supposed to get current matrix and multiply it with translation or scaling matrix and then load it using glloadmatrix and update scene.

Please i have to submit it tomorrow.

i don't want code i want to do it myself as its my homework

but i want you to guide me

```
i have multiplied using following code
GLfloat Matrix[16] = {1,0,0,0,0,1,0,0,0,0,1,0,x,y,0,1};
glMultMatrixf(Matrix);
```

Please help**