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

11.2.1.2 Using a Sphere Map

To use sphere mapping in OpenGL, the following steps are performed:
tex2html_nowrap 28.
Bind the texture containing the sphere map.
tex2html_nowrap 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);
tex2html_nowrap 30.
Enable texture coordinate generation and 2D texturing:
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_2D);
tex2html_nowrap 31.
Draw the object, providing correct normals on a per-face or per-vertex basis.



David Blythe
1999-08-06