next up previous contents
Next: 11.2.1.3 Generating a Sphere Up: 11.2.1 Sphere Mapping Previous: 11.2.1.1 The Mathematics of   Contents

11.2.1.2 Using a Sphere Map

To use sphere mapping in OpenGL, the following steps are performed:
28.
Bind the texture containing the sphere map.
29.
Set sphere mapping texture coordinate generation:
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
30.
Enable texture coordinate generation and 2D texturing:
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_2D);
31.
Draw the object, providing correct normals on a per-face or per-vertex basis.



2001-01-10