The main objective of the project was to use OpenGL primitives to the maximum extent in features like lighting, camera motion, texture mapping & transformations.
We have used two lights with different values for the parameters(ambience, specular, diffuse).
The shading model used was
Camera Motion given in 3 models:
For all the views camera motion was achived by changing the parameters of gluLookAT() function.
In the ball view the camera moves along with the ball. Using Roaming view the user can go around the room and even come outside.
The user can select the ball from the given 4 balls using the mouse. User can change 3 factors of the ball:-
The ball reflection was achieved using a semi-transperent floor below the ball and drawing the same ball again below it.
Using the actual collision for the ball and pins takes a lot of time for all the computations. So we precalculate whichever pin colides and drop the pins accordingly.
The game can be played in any view and in any position and direction of the camera.
1)Movement of camera around the room. It was solved using a cosine function to change the values of the first three parameters of the gluLookAt() function simultaneously.
2)Lighting effect on the floor.
The floor is drawn using around 500 small triangles using glTriangle_Strip. As each triangle receives a different amount of light, a patch of reflection is formed in the floor. The normalization is taken care by glNormalize() function.
3)Mentioned earlier, use ended up doing the precalculated decision for showing the collision and dropping the pins.