Computer
Graphics
Summer
2006
G22.2270-001
Tuesdays,
6pm - 8:20pm
WWH 101
Assigment 2
DUE: Wednesday 6/21/06 midnight (11:59pm)
In this assignment you will set up an environment with textured objects.
Your program should display a scene placed inside a cube. Interior
of each face of the cube should have texture mapped to it. Each
object on the scene will also have a texture. You are free to use any
texture you want.
The scene should contain at least the following objects:
- A texture mapped sphere. Whole surface should be covered by a
texture. Make sure to write your own code for generating the
polygons and texture coordinates for the sphere.
- A texture mapped closed cylinder. Texture should be applied
to the whole surface including caps. Again you should write your own.
- An object of complex shape. glutTeapot is ok. You can write code
to create your own complex object for extra credit. The texture used
for this object should have an alpha channel.
- A texture mapped ground plane.
- A cube surrounding the scene with texture map applied to all five sides. You can find such texture maps at crinity sky maps. Each download involves 6 images, one for each face of the cube. You will need only five of them.
Position the
objects and camera such that the whole scene is visible. Make
sure to transform the cylinder at the scene such that the caps will be
visible. Also tilt the sphere slightly to have the poles visible.
User Interaction
Up/Down Keys : Moves camera away from/towards the center of the scene.
Left/Right Keys : Moves camera to the left/right of the scene.
Key 'm' : Toggle mipmaps for textures
Key 'f' : Toggle filters between linear and nearest neighbor.
Restrictions
Do not use the following commands in this assignment:
*glutSphere, gluSphere
*glutCylinder, gluCylinder
Note: Feel free to use all these commands for debugging your code. Once
you are sure everything else works replace these calls with your
versions.
Implementation Help
The following two files, tga.cpp and tga.h
provide functions to read/write tga files. You can use function calls
within these files to load texture data from images. Note that tga
files encode images using BGRA instead of RGBA. After you read the
image, make sure to write a function that flips the read component with
the blue component.
Note that you can convert any image to tga format using
ImageMagick convert tool or GIMP. Or of course feel free to look for tga files online.
If
you're having trouble with finding images with an alpha channel you can
add one to any image of your own using some image manipulation program.
One set of instructions to do so using Adobe Photoshop can be found at this link: http://www.artifice.com/tips/alpha_textures.html . There is an abundance of such instructions on the web so feel free to search yourself if this is not very clear.
Adapted from one of Denis Zorin's assignments.