Translating texgen

The IRIS GL function texgen is translated to glTexGen for OpenGL.

With IRIS GL, you call texgen twice: once to set the mode and plane equation simultaneously, and once to enable texture-coordinate generation. For example:

texgen(TX_S, TG_LINEAR, planeParams); 
texgen(TX_S, TG_ON, NULL); 
 

With OpenGL, you make three calls: two to glTexGen (once to set the mode and once to set the plane equation), and one to glEnable. For example, the OpenGL equivalent to the IRIS GL code above is:

glTexGen(GL_S, GLTEXTURE_GEN_MODE, modeName); 
glTextGen(GL_S, GL_OBJECT_PLANE, planeParameters); 
glEnable(GL_TEXTURE_GEN_S); 
 

The following table lists the IRIS GL texture-coordinate names and their OpenGL equivalents.

IRIS GL Texture Coordinate OpenGL Texture Coordinate glEnable Argument
TX_S GL_S GL_TEXTURE_GEN_S
TX_T GL_T GL_TEXTURE_GEN_T
TX_R GL_R GL_TEXTURE_GEN_R
TX_Q GL_Q GL_TEXTURE_GEN_Q

The following table lists the IRIS GL texture-generation modes and their equivalent OpenGL texture modes and plane names.

IRIS GL Texture Mode OpenGL Texture Mode OpenGL Plane Name
TG_LINEAR GL_OBJECT_LINEAR GL_OBJECT_PLANE
TG_CONTOUR GL_EYE_LINEAR GL_EYE_PLANE
TG_SPHEREMAP GL_SPHERE_MAP