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:
|
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:
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.
|
|
Cube class: The room will be a large cube or rectangular shape. You will be texturing this cube differently on different sides so you can't use a glutCube. Besides, unlike the teapot, glutCubes do not come with texture coordinates. Instead, list the vertices, faces, and normals as was done in the TextureCube example.
To make the texturing and lighting easier to do for the room, it is recommended that you do the following:
Collisions: Modify your navigation code so that the viewer can't go through the walls, floor, and ceiling. To do this, you need to put contraints on the navigation updates to prevent a collision some distance before reaching the walls, etc. Also check that the near plane of the camera is set fairly small otherwise it will look like you walked through a wall when you are close but not past the wall.
Loading Images: Add code to load the checkerboard and all of your images into texture objects. Look at portions of the TextureCube to see how to do this. Note, you need to load in all of your images into separate texture objects.
Pictures on the walls: Create additional geometry for the "picture frames", e.g. squares or rectangles located just in front of the walls and which are textured with your images. Remember that picture size and/or the texture coordinates need to be chosen so that the picture is not distorted.
Add Lighting: Add at least one light to the center top of the room. Look at the last lab to remember what code needs to be added.
Setting the Mode: In order to mix lighting and texturing, you need to set the environment mode. Experiment with different settings for the mode. For example, to set the mode to GL_MODULATE, add the line
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.
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.
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.