This lab is to illustrate how you can bring images into your drawings using texture mapping.
Create a directory lab8, and copy the necessary files in that directory. If you plan to use one image for all sides, you need one image of 256x356 size. Six images are needed if you wish to use different images on each side of the cube. These images must be of size 256-by-256 in .bmp format. You can use other size image, but for now, let's make that a standard. You can use the PaintShop Pro, Adobe PhotoShop, or Unix-based xv software to change the size of the images you have or save them in the correct format. I have included 6 images in Activity (1) that you can use.
Step 2: VC++ .Net Preparations
The best way to do this lab is to copy the texture mapping program in zip file and expand it. It is best that you open the solution in your .Net area and make changes. This way you will be asked to convert the file to .Net format and by doing this your program will work fine. Remember that your image files will go under the Data directory. You can change that as you wish.
Make sure you are under the lab8 directory. Click on (texture_mapping) to save the zip file, that is the best way. I encourage you to read through the program and make sure you understand how texture mapping is done.
Once you open the solution, run it to make sure it correctly produces the box with one
image on all its sides. Try the up down arrows to make sure they are working.
Now you can modify the program to include 6 different images.
For testing of the code that is giving below, I have saved several 256x256
images with 6 different names.
Image 1: Image1,
Image 2: Image2,
Image 3: Image3,
Image 4: Image4,
Image 5: Image5,
Image 6: Image6.
All images must be stored in the directory Data under lab8 for the program to work correctly. By the way, I have taken or created all these images. Pictures are followers in Boone. Except one, all are pictures stored as bmp images.
I haven't done this myself. I am thinking that it was nice if we could make this box rotate and bounce in the screen (full monitor screen) as a screen saver. Perhaps we need to create an executable file then find a way to convert it.
The box should currently rotates in different directions using the up-down and left-right arrows.
In the program there are two places that you are setting the screen
resolution and the number of bits for the color. These two lines
look like this:
if(!CreateGLWindow("Return_Null's SniperGL RotateWork", 1024, 768, 32, fullscreen))
If you change the screen resolutions and number of bits to smaller values, such as; 640, 480, 16, then your display will become much faster.
Also, if you increase the value of rotation step, that makes the box
to rotate faster. Here is one of the places you will make a change,
there should be four places.
if(keys[VK_UP]) // Has up arrow been pressed?
xspeed -= 0.01f; // Decrease xspeed
That change should be made in xspeed.