Skip to content

In this lab I rendered a room with 4 walls, ceiling, and floor, placed multiple objects in the room, and add two lights in the room (one sunlight and one spotlight). I used different bitmap to texture mapping the walls, ceiling and floor. By using keyboard users can move and look around the room, also user can open and close the light source.

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.

It is a continuous research about OpenGL.

First in Lab 4, I only built a simple goldfish with several components. It tested the build things with polygon.

Second in Lab 5, I added mouse listener with a list to control the fish to circle, swim or rotate. It tested the translate and rotate function.

Third in Lab 6, I added collision situation, when the fish swim to the edge of the screen, it will change the swimming direction. Also added sunlight to test the light code. Left key mouse listener is tested to stop or restart the fish swimming.

Forth in Lab 7, it includes all the function realized in Lab 6. Additional mouse listener with a list to change the color set of the fish. It aims to test the color reflection with the same light source (sun light).

Finally in Lab 8, the mouse listener contains two lists - one for color change and another to change the light source. It aims to test the influence with different color and different light source.

It is a simple OpenGL designed with visual studio 2015. In the project I drew two models - car and a square. Users can use keyboard 'w', 'a', 's', 'd' (no matter it is capital or not) to translate the car up, down, left or right. Also they can use mouse to rotate the car (left button to rotate up and down, right button to rotate left to right). When a collision occurred between two models, the square will disappear from the screen until the collision disappear.