1GLTEXGEN(3G)                                                      GLTEXGEN(3G)
2
3
4

NAME

6       glTexGend,  glTexGenf,  glTexGeni, glTexGendv, glTexGenfv, glTexGeniv -
7       control the generation of texture coordinates
8
9

C SPECIFICATION

11       void glTexGend( GLenum coord,
12                       GLenum pname,
13                       GLdouble param )
14       void glTexGenf( GLenum coord,
15                       GLenum pname,
16                       GLfloat param )
17       void glTexGeni( GLenum coord,
18                       GLenum pname,
19                       GLint param )
20
21

PARAMETERS

23       coord   Specifies a texture coordinate.  Must be  one  of  GL_S,  GL_T,
24               GL_R, or GL_Q.
25
26       pname   Specifies  the  symbolic name of the texture-coordinate genera‐
27               tion function.  Must be GL_TEXTURE_GEN_MODE.
28
29       param   Specifies a single-valued texture generation parameter, one  of
30               GL_OBJECT_LINEAR, GL_EYE_LINEAR, or GL_SPHERE_MAP.
31

C SPECIFICATION

33       void glTexGendv( GLenum coord,
34                        GLenum pname,
35                        const GLdouble *params )
36       void glTexGenfv( GLenum coord,
37                        GLenum pname,
38                        const GLfloat *params )
39       void glTexGeniv( GLenum coord,
40                        GLenum pname,
41                        const GLint *params )
42
43

PARAMETERS

45       coord  Specifies  a  texture  coordinate.   Must  be one of GL_S, GL_T,
46              GL_R, or GL_Q.
47
48       pname  Specifies the symbolic name of the texture-coordinate generation
49              function  or  function parameters.  Must be GL_TEXTURE_GEN_MODE,
50              GL_OBJECT_PLANE, or GL_EYE_PLANE.
51
52       params Specifies a pointer to an array of  texture  generation  parame‐
53              ters.  If pname is GL_TEXTURE_GEN_MODE, then the array must con‐
54              tain  a  single  symbolic  constant,  one  of  GL_OBJECT_LINEAR,
55              GL_EYE_LINEAR,  or  GL_SPHERE_MAP.   Otherwise, params holds the
56              coefficients  for  the  texture-coordinate  generation  function
57              specified by pname.
58

DESCRIPTION

60       glTexGen  selects  a texture-coordinate generation function or supplies
61       coefficients for one of the functions.  coord names one of the  (s,  t,
62       r,  q)  texture  coordinates; it must be one of the symbols GL_S, GL_T,
63       GL_R, or  GL_Q.   pname  must  be  one  of  three  symbolic  constants:
64       GL_TEXTURE_GEN_MODE,  GL_OBJECT_PLANE,  or  GL_EYE_PLANE.   If pname is
65       GL_TEXTURE_GEN_MODE,   then   params   chooses   a   mode,    one    of
66       GL_OBJECT_LINEAR,  GL_EYE_LINEAR, or GL_SPHERE_MAP.  If pname is either
67       GL_OBJECT_PLANE or GL_EYE_PLANE, params contains coefficients  for  the
68       corresponding texture generation function.
69
70       If the texture generation function is GL_OBJECT_LINEAR, the function
71
72                                g=p1xo+p2yo+p3zo+p4wo
73
74       is  used,  where  g  is  the value computed for the coordinate named in
75       coord, p1, p2, p3, and p4 are the four values supplied in  params,  and
76       xo,  yo,  zo,  and  wo  are the object coordinates of the vertex.  This
77       function can be used, for example, to  texture-map  terrain  using  sea
78       level  as a reference plane (defined by p1, p2, p3, and p4).  The alti‐
79       tude of a terrain vertex is computed by the GL_OBJECT_LINEAR coordinate
80       generation  function  as its distance from sea level; that altitude can
81       then be used to index the texture image to map white  snow  onto  peaks
82       and green grass onto foothills.
83
84       If the texture generation function is GL_EYE_LINEAR, the function
85
86                                g=p′1xe+p′2ye+p′3ze+p′4we
87
88       is used, where
89
90                              (p′1p′2p′3p′4)=(p1p2p3p4)M−1
91
92       and  xe,  ye, ze, and we are the eye coordinates of the vertex, p1, p2,
93       p3, and p4 are the values supplied in params, and M  is  the  modelview
94       matrix  when glTexGen is invoked.  If M is poorly conditioned or singu‐
95       lar, texture coordinates generated by the  resulting  function  may  be
96       inaccurate or undefined.
97
98       Note  that the values in params define a reference plane in eye coordi‐
99       nates.  The modelview matrix that is applied to them  may  not  be  the
100       same  one  in  effect  when the polygon vertices are transformed.  This
101       function establishes a field of texture coordinates  that  can  produce
102       dynamic contour lines on moving objects.
103
104       If  pname  is  GL_SPHERE_MAP  and coord is either GL_S or GL_T, s and t
105       texture coordinates are generated as follows.  Let u be the unit vector
106       pointing  from  the  origin to the polygon vertex (in eye coordinates).
107       Let n sup prime be the current  normal,  after  transformation  to  eye
108       coordinates.  Let
109
110                                     f=(fxfyfz)T
111       be the reflection vector such that
112
113                                     f=u−2nnTu
114
115       Finally,  let m=2√f2x+f2y+(fz+1)2.  Then the values assigned to the s and
116       t texture coordinates are
117
118                                       s=f_xm_+12_
119
120                                       t=f_ym_+12_
121
122       To enable or disable a  texture-coordinate  generation  function,  call
123       glEnable or glDisable with one of the symbolic texture-coordinate names
124       (GL_TEXTURE_GEN_S,     GL_TEXTURE_GEN_T,      GL_TEXTURE_GEN_R,      or
125       GL_TEXTURE_GEN_Q) as the argument.  When enabled, the specified texture
126       coordinate is computed according to the generating function  associated
127       with  that  coordinate.   When  disabled,  subsequent vertices take the
128       specified texture coordinate from the current set  of  texture  coordi‐
129       nates.   Initially,   all  texture  generation  functions  are  set  to
130       GL_EYE_LINEAR and are disabled.  Both s plane equations are (1,  0,  0,
131       0),  both  t  plane  equations  are (0, 1, 0, 0), and all r and q plane
132       equations are (0, 0, 0, 0).
133
134       When the GL_ARB_multitexture extension is supported, glTexGen  set  the
135       texture  generation  parameters  for the currently active texture unit,
136       selected with glActiveTextureARB.
137

ERRORS

139       GL_INVALID_ENUM is generated when coord or pname  is  not  an  accepted
140       defined  value,  or when pname is GL_TEXTURE_GEN_MODE and params is not
141       an accepted defined value.
142
143       GL_INVALID_ENUM is generated when pname is GL_TEXTURE_GEN_MODE,  params
144       is GL_SPHERE_MAP, and coord is either GL_R or GL_Q.
145
146       GL_INVALID_OPERATION  is  generated if glTexGen is executed between the
147       execution of glBegin and the corresponding execution of glEnd.
148

ASSOCIATED GETS

150       glGetTexGen
151       glIsEnabled with argument GL_TEXTURE_GEN_S
152       glIsEnabled with argument GL_TEXTURE_GEN_T
153       glIsEnabled with argument GL_TEXTURE_GEN_R
154       glIsEnabled with argument GL_TEXTURE_GEN_Q
155

SEE ALSO

157       glActiveTextureARB(3G),     glCopyPixels(3G),     glCopyTexImage2D(3G),
158       glCopyTexSubImage1D(3G),                       glCopyTexSubImage2D(3G),
159       glCopyTexSubImage3D(3G),        glTexEnv(3G),         glTexImage1D(3G),
160       glTexImage2D(3G),         glTexImage3D(3G),         glTexParameter(3G),
161       glTexSubImage1D(3G), glTexSubImage2D(3G), glTexSubImage3D(3G)
162
163
164
165                                                                  GLTEXGEN(3G)
Impressum