Porting Texture Functions

When porting IRIS GL texture functions to OpenGL, keep the following points in mind:

  • OpenGL doesn't maintain tables of textures; it uses either 1-D texture and 2-D texture only. To reuse the textures from your IRIS GL code, put them in a display list.

  • OpenGL doesn't automatically generate mipmaps. If you're using mipmaps, you must first call the gluBuild2DMipmaps function.

  • In OpenGL, you use glEnable and glDisable to turn texturing capabilities on and off.

  • In OpenGL, texture size is more strictly regulated than in IRIS GL. The size of an OpenGL texture must be:

    2n + 2b

    where n is an integer and b is:

    • 0, if the texture has no border
    • 1, if the texture has a border pixel (OpenGL textures can have 1-pixel borders.)

The following table lists IRIS GL texture functions and their general OpenGL equivalents.

IRIS GL function OpenGL function Meaning
textdef2d glTexImage2DglTexParameter
gluBuild2DMipmaps
Specifies a 2-D texture image.
textbind glTexImage2DglTexParameter
gluBuild2DMipmaps
Selects a texture function.
tevdef glTexEnv Defines a texture-mapping environment.
tevbind glTexEnvglTexImage1D
Selects a texture environment.
t2 glTexCoord Sets the current texture coordinates.
texgen glTexGenglGetTexParameter
gluBuild1DMipmaps
gluBuild2DMipmaps
gluScaleImage
Controls generation of texture coordinates.Scales an image to an arbitrary size.

For more information on texturing, see the OpenGL Programming Guide.

This topic includes information on the following.