Texture Mapping

Bryson R. Payne, M.Ed.

Textured teapot exampleDiscussion:

There are several different ways of mapping textures onto surfaces in OpenGL. This example uses a header file called "bitmap.h" from the OpenGL SuperBible (2nd Ed., Waite Group Press) to load a standard .BMP file as a texture map for a GLUT teapot. To see different textures on the teapot, you can download the executable file below and place a bitmap called "marble.bmp" in the same directory and run the program. As long as the BMP file you save under that name is sized 2^n by 2^m (i.e. 256x128, 32x64, etc.), you will be able to see that image tiled around the teapot shaded red. Two new variables and just a few lines of code make this impressive change possible. 

Sample code:

Click here to see the sample code: texturing.c

Executable example:

Click here for a running demo: texturing.exe, marble.bmp


Back to Main Tutorial Page

Last modified December 11, 2000, Bryson R. Payne, bpayne@ngcsu.edu