Lab 5: Textures
CS 445: Computer Graphics, Fall 2010


[previous lab][schedule][next lab]
Assignments are due at the beginning of class on Tues, Nov 16. For details on what to turn in, see the Deliverables section at the bottom of this page.

Goals


Practice (not to be turned in)

Getting started with the texture parameters: Take a look at Nate Robbin's texture.exe tutorial to see how the parameters affect the resulting image.

Code Example:

  • Download and run the TextureCube program. Read through it carefully so that you understand what it is doing. Try changing the values of the texture coordinates. Try modifying the checkerboard texture to get something different, e.g. horizontal or diagonal stripes, sin waves, etc.
  • In the code, replace the image of Percy with one of your own images. In order to use an image as a texture in OpenGL, it is important to remember that:
    • the image's width and height need to be powers of two (this is not true for new versions of OpenGL)
    • The image should not be too large (ideally at most 128x128).

You may need to use some photo editing software to convert your images into the proper size. The TextureCube code works with jpg files but may not work with other image formats. If the image doesn't show when you run the program, it is probably because it was not resized properly. Try adding additional choices for images.

General Steps involved:


Creating a Scene (to be turned in)

In this part of the lab, you are to create a complex scene that combines:

You may do whatever type of scene you like as long as it has the above characteristics and it has a complexity similar to the examples below. Keep things as modular as possible. For example, you should probably have separate classes for the geometry (e.g. cube), lights, navigation, textures. Otherwise your listener code will be too large and unwieldy. Now is a good time to try to get organized before you start your final project in the next lab.

Below are two examples. You may choose to work on one of them or you may choose something else with similar complexity.

Example 1: A Virtual Museum

  • Navigation and Geometry: Create a room with various pictures on the walls as though you were in a museum. The floor should be textured in some way. Lighting should be turned on and you should be able to navigate around. You could also place some simple furniture (e.g. a cube table with teapot!) around the room.

Example 2: A Virtual City

Create a city consisting of buildings and a large rectangle for the ground which is also textured. Review the instructions above for the museum for things you need to think about. The buildings can all be scaled cubes. It is probably easier to create several simple textures in Photoshop rather than trying to find good building or road textures online.

Shaders: Extra Credit (5 pts)

Download ShaderLabExample.zip. This has a number of different shaders included. Run the code and try changing the shaders to see what each does. We will go over this code in class.

For extra credit, take an earlier lab (e.g. algebraic surface or DEM) and add a vertex and fragment shader to compute the shading. Try several different shaders.

Deliverables:

By class time on Tues, Nov 16: Submit your zipped Netbeans program (with the images you used) to Wise. Be sure to include a working jar file. on enfuzion. Be prepared to demo your program and to discuss what you discovered.


[top]  [Schedule]  [Home]