Skip to content

Computer Graphics I – lab 2 outcome

This lab I use keyboard to translate, rotate and scale the cow, also keyboard can translate and rotate the camera.

The cow are redrew by triangles and filled with random colors.

I used visual studio 2015 and the header file in the former folder is for visual studio 2010. So I replace .h file in the source folder and glut.dll file.

In model.h I compile three functions: scale, translate and rotate to control the change of the cow. Another function drawpolygon is used to draw the cow with polygon with random colors.

In simpleGLUT.cpp file I claimed two arraies (eye[] and center[]) to store the camera position used in gluLookAt. In the keyboard control function I used 'w' 'a' 's' 'd' to translate the model, 'q' 'e' to scale the model and 'z' 'c' to rotate the model. Also 'i' 'j' 'k' 'l' to translate the camera and 'u' 'o' to rotate the camera by changing the gluLookAt matrix.

Leave a Reply

Your email address will not be published. Required fields are marked *