1GLTEXENV(3G)                     OpenGL Manual                    GLTEXENV(3G)
2
3
4

NAME

6       glTexEnv - set texture environment parameters
7

C SPECIFICATION

9       void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
10
11       void glTexEnvi(GLenum target, GLenum pname, GLint param);
12

PARAMETERS

14       target
15           Specifies a texture environment. May be GL_TEXTURE_ENV,
16           GL_TEXTURE_FILTER_CONTROL or GL_POINT_SPRITE.
17
18       pname
19           Specifies the symbolic name of a single-valued texture environment
20           parameter. May be either GL_TEXTURE_ENV_MODE, GL_TEXTURE_LOD_BIAS,
21           GL_COMBINE_RGB, GL_COMBINE_ALPHA, GL_SRC0_RGB, GL_SRC1_RGB,
22           GL_SRC2_RGB, GL_SRC0_ALPHA, GL_SRC1_ALPHA, GL_SRC2_ALPHA,
23           GL_OPERAND0_RGB, GL_OPERAND1_RGB, GL_OPERAND2_RGB,
24           GL_OPERAND0_ALPHA, GL_OPERAND1_ALPHA, GL_OPERAND2_ALPHA,
25           GL_RGB_SCALE, GL_ALPHA_SCALE, or GL_COORD_REPLACE.
26
27       param
28           Specifies a single symbolic constant, one of GL_ADD, GL_ADD_SIGNED,
29           GL_INTERPOLATE, GL_MODULATE, GL_DECAL, GL_BLEND, GL_REPLACE,
30           GL_SUBTRACT, GL_COMBINE, GL_TEXTURE, GL_CONSTANT, GL_PRIMARY_COLOR,
31           GL_PREVIOUS, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA,
32           GL_ONE_MINUS_SRC_ALPHA, a single boolean value for the point sprite
33           texture coordinate replacement, a single floating-point value for
34           the texture level-of-detail bias, or 1.0, 2.0, or 4.0 when
35           specifying the GL_RGB_SCALE or GL_ALPHA_SCALE.
36

C SPECIFICATION

38       void glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params);
39
40       void glTexEnviv(GLenum target, GLenum pname, const GLint * params);
41

PARAMETERS

43       target
44           Specifies a texture environment. May be either GL_TEXTURE_ENV, or
45           GL_TEXTURE_FILTER_CONTROL.
46
47       pname
48           Specifies the symbolic name of a texture environment parameter.
49           Accepted values are GL_TEXTURE_ENV_MODE, GL_TEXTURE_ENV_COLOR, or
50           GL_TEXTURE_LOD_BIAS.
51
52       params
53           Specifies a pointer to a parameter array that contains either a
54           single symbolic constant, single floating-point number, or an RGBA
55           color.
56

DESCRIPTION

58       A texture environment specifies how texture values are interpreted when
59       a fragment is textured. When target is GL_TEXTURE_FILTER_CONTROL, pname
60       must be GL_TEXTURE_LOD_BIAS. When target is GL_TEXTURE_ENV, pname can
61       be GL_TEXTURE_ENV_MODE, GL_TEXTURE_ENV_COLOR, GL_COMBINE_RGB,
62       GL_COMBINE_ALPHA, GL_RGB_SCALE, GL_ALPHA_SCALE, GL_SRC0_RGB,
63       GL_SRC1_RGB, GL_SRC2_RGB, GL_SRC0_ALPHA, GL_SRC1_ALPHA, or
64       GL_SRC2_ALPHA.
65
66       If pname is GL_TEXTURE_ENV_MODE, then params is (or points to) the
67       symbolic name of a texture function. Six texture functions may be
68       specified: GL_ADD, GL_MODULATE, GL_DECAL, GL_BLEND, GL_REPLACE, or
69       GL_COMBINE.
70
71       The following table shows the correspondence of filtered texture values
72       R t, G t, B t, A t, L t, I t to texture source components.  C s and A s
73       are used by the texture functions described below.
74
75       ┌───────────────────┬────────────────────────────┬───────────────────────────┐
76Texture Base       C                          A                         
77Internal Format    s  s 
78       ├───────────────────┼────────────────────────────┼───────────────────────────┤
79GL_ALPHA           │ (0, 0, 0)                  │ A                         │
80       │                   │                            │                         t │
81       ├───────────────────┼────────────────────────────┼───────────────────────────┤
82GL_LUMINANCE       │ (                          │ 1                         │
83       │                   │                         L  │                           │
84       │                   │                         t, │                           │
85       │                   │                         L  │                           │
86       │                   │                         t, │                           │
87       │                   │                         L  │                           │
88       │                   │                         t  │                           │
89       │                   │                         )  │                           │
90       ├───────────────────┼────────────────────────────┼───────────────────────────┤
91GL_LUMINANCE_ALPHA │ (                          │ A                         │
92       │                   │                         L  │                         t │
93       │                   │                         t, │                           │
94       │                   │                         L  │                           │
95       │                   │                         t, │                           │
96       │                   │                         L  │                           │
97       │                   │                         t  │                           │
98       │                   │                         )  │                           │
99       ├───────────────────┼────────────────────────────┼───────────────────────────┤
100GL_INTENSITY       │ (                          │ I                         │
101       │                   │                         I  │                         t │
102       │                   │                         t, │                           │
103       │                   │                         I  │                           │
104       │                   │                         t, │                           │
105       │                   │                         I  │                           │
106       │                   │                         t  │                           │
107       │                   │                         )  │                           │
108       ├───────────────────┼────────────────────────────┼───────────────────────────┤
109GL_RGB             │ (                          │ 1                         │
110       │                   │                         R  │                           │
111       │                   │                         t, │                           │
112       │                   │                         G  │                           │
113       │                   │                         t, │                           │
114       │                   │                         B  │                           │
115       │                   │                         t  │                           │
116       │                   │                         )  │                           │
117       ├───────────────────┼────────────────────────────┼───────────────────────────┤
118GL_RGBA            │ (                          │ A                         │
119       │                   │                         R  │                         t │
120       │                   │                         t, │                           │
121       │                   │                         G  │                           │
122       │                   │                         t, │                           │
123       │                   │                         B  │                           │
124       │                   │                         t  │                           │
125       │                   │                         )  │                           │
126       └───────────────────┴────────────────────────────┴───────────────────────────┘
127
128       A texture function acts on the fragment to be textured using the
129       texture image value that applies to the fragment (see glTexParameter())
130       and produces an RGBA color for that fragment. The following table shows
131       how the RGBA color is produced for each of the first five texture
132       functions that can be chosen.  C is a triple of color values (RGB) and
133       A is the associated alpha value. RGBA values extracted from a texture
134       image are in the range [0,1]. The subscript p refers to the color
135       computed from the previous texture stage (or the incoming fragment if
136       processing texture stage 0), the subscript s to the texture source
137       color, the subscript c to the texture environment color, and the
138       subscript v indicates a value produced by the texture function.
139
140       ┌─────────────────┬────────────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬────────────────────────────────────┐
141Texture      Value              GL_REPLACE            GL_MODULATE             GL_DECAL                   GL_BLEND                   GL_ADD                 
142Base         │                                │          Function              │            Function                │                 Function                   │                 Function                   │             Function               │
143Internal     │                                │                                │                                    │                                            │                                            │                                    │
144Format       │                                │                                │                                    │                                            │                                            │                                    │
145       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
146GL_ALPHA     │C                                │C                                │ C                                  │                 undefined                  │     C                                      │ C                                  │
147       │                 │                               v│                               p│                                 p  │                                            │                                     p      │                                 p  │
148       │                 │                                │                                │                                    │                                            │                                            │                                    │
149       │                 │                               =│                                │                                    │                                            │                                            │                                    │
150       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
151       │                 │A                                │A                                │A                                    │                                            │   A                                        │A                                    │
152       │                 │                               v│                               s│                                   p│                                            │                                   v        │                                   p│
153       │                 │                                │                                │                                    │                                            │                                            │                                    │
154       │                 │                               =│                                │                                   ⁢│                                            │                                   =        │                                   ⁢│
155       │                 │                                │                                │                                   A│                                            │                                            │                                   A│
156       │                 │                                │                                │                                   s│                                            │                                       A    │                                   s│
157       │                 │                                │                                │                                    │                                            │                                       p    │                                    │
158       │                 │                                │                                │                                    │                                            │                                            │                                    │
159       │                 │                                │                                │                                    │                                            │                                       ⁢    │                                    │
160       │                 │                                │                                │                                    │                                            │                                       A    │                                    │
161       │                 │                                │                                │                                    │                                            │                                       s    │                                    │
162       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
163GL_LUMINANCE   │C                                │C                                │C                                    │                 undefined                  │C                                            │C                                    │
164       │                 │                               v│                               s│                                   p│                                            │                                   p        │                                   p│
165       │                 │                                │                                │                                    │                                            │                                            │                                    │
166       │                 │                               =│                                │                                   ⁢│                                            │                                   ⁢        │                                   +│
167       │                 │                                │                                │                                   C│                                            │                                            │                                   C│
168       │                 │                                │                                │                                   s│                                            │                                            │                                   s│
169       │                 │                                │                                │                                    │                                            │                                           1│                                    │
170       │                 │                                │                                │                                    │                                            │                                           -│                                    │
171       │                 │                                │                                │                                    │                                            │                                           C│                                    │
172       │                 │                                │                                │                                    │                                            │                                           s│                                    │
173       │                 │                                │                                │                                    │                                            │                                            │                                    │
174       │                 │                                │                                │                                    │                                            │                                            │                                    │
175       │                 │                                │                                │                                    │                                            │                                            │                                    │
176       │                 │                                │                                │                                    │                                            │                                   +        │                                    │
177       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
178       │                 │                                │                                │                                    │                                            │                                   c        │                                    │
179       │                 │                                │                                │                                    │                                            │                                            │                                    │
180       │                 │                                │                                │                                    │                                            │                                   ⁢        │                                    │
181       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
182       │                 │                                │                                │                                    │                                            │                                   s        │                                    │
183       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
184       │     (or 1)      │A                                │A                                │ A                                  │                                            │     A                                      │ A                                  │
185       │                 │                               v│                               p│                                 p  │                                            │                                     p      │                                 p  │
186       │                 │                                │                                │                                    │                                            │                                            │                                    │
187       │                 │                               =│                                │                                    │                                            │                                            │                                    │
188       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
189       │GL_LUMINANCE_ALPHA│C                                │C                                │C                                    │                 undefined                  │C                                            │C                                    │
190       │                 │                               v│                               s│                                   p│                                            │                                   p        │                                   p│
191       │                 │                                │                                │                                    │                                            │                                            │                                    │
192       │                 │                               =│                                │                                   ⁢│                                            │                                   ⁢        │                                   +│
193       │                 │                                │                                │                                   C│                                            │                                            │                                   C│
194       │                 │                                │                                │                                   s│                                            │                                            │                                   s│
195       │                 │                                │                                │                                    │                                            │                                           1│                                    │
196       │                 │                                │                                │                                    │                                            │                                           -│                                    │
197       │                 │                                │                                │                                    │                                            │                                           C│                                    │
198       │                 │                                │                                │                                    │                                            │                                           s│                                    │
199       │                 │                                │                                │                                    │                                            │                                            │                                    │
200       │                 │                                │                                │                                    │                                            │                                            │                                    │
201       │                 │                                │                                │                                    │                                            │                                            │                                    │
202       │                 │                                │                                │                                    │                                            │                                   +        │                                    │
203       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
204       │                 │                                │                                │                                    │                                            │                                   c        │                                    │
205       │                 │                                │                                │                                    │                                            │                                            │                                    │
206       │                 │                                │                                │                                    │                                            │                                   ⁢        │                                    │
207       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
208       │                 │                                │                                │                                    │                                            │                                   s        │                                    │
209       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
210       │     (or 2)      │A                                │A                                │A                                    │                                            │   A                                        │A                                    │
211       │                 │                               v│                               s│                                   p│                                            │                                       p    │                                   p│
212       │                 │                                │                                │                                    │                                            │                                            │                                    │
213       │                 │                               =│                                │                                   ⁢│                                            │                                       ⁢    │                                   ⁢│
214       │                 │                                │                                │                                   A│                                            │                                       A    │                                   A│
215       │                 │                                │                                │                                   s│                                            │                                       s    │                                   s│
216       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
217GL_INTENSITY   │C                                │C                                │C                                    │                 undefined                  │C                                            │C                                    │
218       │                 │                               v│                               s│                                   p│                                            │                                   p        │                                   p│
219       │                 │                                │                                │                                    │                                            │                                            │                                    │
220       │                 │                               =│                                │                                   ⁢│                                            │                                   ⁢        │                                   +│
221       │                 │                                │                                │                                   C│                                            │                                            │                                   C│
222       │                 │                                │                                │                                   s│                                            │                                            │                                   s│
223       │                 │                                │                                │                                    │                                            │                                           1│                                    │
224       │                 │                                │                                │                                    │                                            │                                           -│                                    │
225       │                 │                                │                                │                                    │                                            │                                           C│                                    │
226       │                 │                                │                                │                                    │                                            │                                           s│                                    │
227       │                 │                                │                                │                                    │                                            │                                            │                                    │
228       │                 │                                │                                │                                    │                                            │                                            │                                    │
229       │                 │                                │                                │                                    │                                            │                                            │                                    │
230       │                 │                                │                                │                                    │                                            │                                   +        │                                    │
231       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
232       │                 │                                │                                │                                    │                                            │                                   c        │                                    │
233       │                 │                                │                                │                                    │                                            │                                            │                                    │
234       │                 │                                │                                │                                    │                                            │                                   ⁢        │                                    │
235       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
236       │                 │                                │                                │                                    │                                            │                                   s        │                                    │
237       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
238       │                 │A                                │A                                │A                                    │                                            │A                                            │A                                    │
239       │                 │                               v│                               s│                                   p│                                            │                                   p        │                                   p│
240       │                 │                                │                                │                                    │                                            │                                            │                                    │
241       │                 │                               =│                                │                                   ⁢│                                            │                                   ⁢        │                                   +│
242       │                 │                                │                                │                                   A│                                            │                                            │                                   A│
243       │                 │                                │                                │                                   s│                                            │                                            │                                   s│
244       │                 │                                │                                │                                    │                                            │                                           1│                                    │
245       │                 │                                │                                │                                    │                                            │                                           -│                                    │
246       │                 │                                │                                │                                    │                                            │                                           A│                                    │
247       │                 │                                │                                │                                    │                                            │                                           s│                                    │
248       │                 │                                │                                │                                    │                                            │                                            │                                    │
249       │                 │                                │                                │                                    │                                            │                                            │                                    │
250       │                 │                                │                                │                                    │                                            │                                            │                                    │
251       │                 │                                │                                │                                    │                                            │                                   +        │                                    │
252       │                 │                                │                                │                                    │                                            │                                   A        │                                    │
253       │                 │                                │                                │                                    │                                            │                                   c        │                                    │
254       │                 │                                │                                │                                    │                                            │                                            │                                    │
255       │                 │                                │                                │                                    │                                            │                                   ⁢        │                                    │
256       │                 │                                │                                │                                    │                                            │                                   A        │                                    │
257       │                 │                                │                                │                                    │                                            │                                   s        │                                    │
258       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
259GL_RGB      │C                                │C                                │C                                    │     C                                      │C                                            │C                                    │
260       │                 │                               v│                               s│                                   p│                                     s      │                                   p        │                                   p│
261       │                 │                                │                                │                                    │                                            │                                            │                                    │
262       │                 │                               =│                                │                                   ⁢│                                            │                                   ⁢        │                                   +│
263       │                 │                                │                                │                                   C│                                            │                                            │                                   C│
264       │                 │                                │                                │                                   s│                                            │                                            │                                   s│
265       │                 │                                │                                │                                    │                                            │                                           1│                                    │
266       │                 │                                │                                │                                    │                                            │                                           -│                                    │
267       │                 │                                │                                │                                    │                                            │                                           C│                                    │
268       │                 │                                │                                │                                    │                                            │                                           s│                                    │
269       │                 │                                │                                │                                    │                                            │                                            │                                    │
270       │                 │                                │                                │                                    │                                            │                                            │                                    │
271       │                 │                                │                                │                                    │                                            │                                            │                                    │
272       │                 │                                │                                │                                    │                                            │                                   +        │                                    │
273       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
274       │                 │                                │                                │                                    │                                            │                                   c        │                                    │
275       │                 │                                │                                │                                    │                                            │                                            │                                    │
276       │                 │                                │                                │                                    │                                            │                                   ⁢        │                                    │
277       │                 │                                │                                │                                    │                                            │                                   C        │                                    │
278       │                 │                                │                                │                                    │                                            │                                   s        │                                    │
279       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
280       │     (or 3)      │A                                │A                                │ A                                  │     A                                      │     A                                      │ A                                  │
281       │                 │                               v│                               p│                                 p  │                                     p      │                                     p      │                                 p  │
282       │                 │                                │                                │                                    │                                            │                                            │                                    │
283       │                 │                               =│                                │                                    │                                            │                                            │                                    │
284       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
285GL_RGBA      │C                                │C                                │C                                    │C                                            │C                                            │C                                    │
286       │                 │                               v│                               s│                                   p│                                   p        │                                   p        │                                   p│
287       │                 │                                │                                │                                    │                                            │                                            │                                    │
288       │                 │                               =│                                │                                   ⁢│                                   ⁢        │                                   ⁢        │                                   +│
289       │                 │                                │                                │                                   C│                                            │                                            │                                   C│
290       │                 │                                │                                │                                   s│                                            │                                            │                                   s│
291       │                 │                                │                                │                                    │                                           1│                                           1│                                    │
292       │                 │                                │                                │                                    │                                           -│                                           -│                                    │
293       │                 │                                │                                │                                    │                                           A│                                           C│                                    │
294       │                 │                                │                                │                                    │                                           s│                                           s│                                    │
295       │                 │                                │                                │                                    │                                            │                                            │                                    │
296       │                 │                                │                                │                                    │                                            │                                            │                                    │
297       │                 │                                │                                │                                    │                                            │                                            │                                    │
298       │                 │                                │                                │                                    │                                   +        │                                   +        │                                    │
299       │                 │                                │                                │                                    │                                   C        │                                   C        │                                    │
300       │                 │                                │                                │                                    │                                   s        │                                   c        │                                    │
301       │                 │                                │                                │                                    │                                            │                                            │                                    │
302       │                 │                                │                                │                                    │                                   ⁢        │                                   ⁢        │                                    │
303       │                 │                                │                                │                                    │                                   A        │                                   C        │                                    │
304       │                 │                                │                                │                                    │                                   s        │                                   s        │                                    │
305       ├─────────────────┼────────────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────────────────────────────┤
306       │     (or 4)      │A                                │A                                │A                                    │     A                                      │   A                                        │A                                    │
307       │                 │                               v│                               s│                                   p│                                     p      │                                       p    │                                   p│
308       │                 │                                │                                │                                    │                                            │                                            │                                    │
309       │                 │                               =│                                │                                   ⁢│                                            │                                       ⁢    │                                   ⁢│
310       │                 │                                │                                │                                   A│                                            │                                       A    │                                   A│
311       │                 │                                │                                │                                   s│                                            │                                       s    │                                   s│
312       └─────────────────┴────────────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴────────────────────────────────────┘
313
314       If pname is GL_TEXTURE_ENV_MODE, and params is GL_COMBINE, the form of
315       the texture function depends on the values of GL_COMBINE_RGB and
316       GL_COMBINE_ALPHA.
317
318       The following describes how the texture sources, as specified by
319       GL_SRC0_RGB, GL_SRC1_RGB, GL_SRC2_RGB, GL_SRC0_ALPHA, GL_SRC1_ALPHA,
320       and GL_SRC2_ALPHA, are combined to produce a final texture color. In
321       the following tables, GL_SRC0_c is represented by Arg0, GL_SRC1_c is
322       represented by Arg1, and GL_SRC2_c is represented by Arg2.
323
324       GL_COMBINE_RGB accepts any of GL_REPLACE, GL_MODULATE, GL_ADD,
325       GL_ADD_SIGNED, GL_INTERPOLATE, GL_SUBTRACT, GL_DOT3_RGB, or
326       GL_DOT3_RGBA.
327
328       ┌───────────────────────────────────────┬──────────────────────────────────────────────────────────────────┐
329       │                                       │                                                                  │
330GL_COMBINE_RGB Texture                                  
331       │                                       │ Function                                                         
332       │                                       │                                                                  │
333       ├───────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
334GL_REPLACE                             │ Arg0                                                             │
335       ├───────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
336GL_MODULATE                            │ Arg0                                                             │
337       │                                       │                                 ×                                │
338       │                                       │                                 Arg1                             │
339       ├───────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
340GL_ADD                                 │ Arg0                                                             │
341       │                                       │                                 +                                │
342       │                                       │                                 Arg1                             │
343       ├───────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
344GL_ADD_SIGNED                          │ Arg0                                                             │
345       │                                       │                                 +                                │
346       │                                       │                                 Arg1                             │
347       │                                       │                                 -                                │
348       │                                       │                                 0.5                              │
349       ├───────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
350GL_INTERPOLATE                         │ Arg0                                                             │
351       │                                       │                                     ×                            │
352       │                                       │                                     Arg2                         │
353       │                                       │                                                                  │
354       │                                       │                                 +                                │
355       │                                       │                                                                  │
356       │                                       │                                     Arg1                         │
357       │                                       │                                     ×                            │
358       │                                       │                                                                  │
359       │                                       │                                                                  │
360       │                                       │                                             1                    │
361       │                                       │                                             -                    │
362       │                                       │                                             Arg2                 │
363       ├───────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
364GL_SUBTRACT                            │ Arg0                                                             │
365       │                                       │                                 -                                │
366       │                                       │                                 Arg1                             │
367       ├───────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
368GL_DOT3_RGB                            │ 4                                                                │
369       │                        or             │                                 ×                                │
370GL_DOT3_RGBA   │                                                                  │
371       │                                       │                                                                  │
372       │                                       │                                                                  │
373       │                                       │                                                                  │
374       │                                       │                                                                  │
375       │                                       │                                                                  │
376       │                                       │                                                                  │
377       │                                       │                                                             Arg0 │
378       │                                       │                                                             r    │
379       │                                       │                                                                  │
380       │                                       │                                                                  │
381       │                                       │                                                         -        │
382       │                                       │                                                         0.5      │
383       │                                       │                                                                  │
384       │                                       │                                                                  │
385       │                                       │                                                 ×                │
386       │                                       │                                                                  │
387       │                                       │                                                                  │
388       │                                       │                                                                  │
389       │                                       │                                                             Arg1 │
390       │                                       │                                                             r    │
391       │                                       │                                                                  │
392       │                                       │                                                                  │
393       │                                       │                                                         -        │
394       │                                       │                                                         0.5      │
395       │                                       │                                                                  │
396       │                                       │                                                                  │
397       │                                       │                                                                  │
398       │                                       │                                                                  │
399       │                                       │                                         +                        │
400       │                                       │                                                                  │
401       │                                       │                                                                  │
402       │                                       │                                                                  │
403       │                                       │                                                                  │
404       │                                       │                                                                  │
405       │                                       │                                                             Arg0 │
406       │                                       │                                                             g    │
407       │                                       │                                                                  │
408       │                                       │                                                                  │
409       │                                       │                                                         -        │
410       │                                       │                                                         0.5      │
411       │                                       │                                                                  │
412       │                                       │                                                                  │
413       │                                       │                                                 ×                │
414       │                                       │                                                                  │
415       │                                       │                                                                  │
416       │                                       │                                                                  │
417       │                                       │                                                             Arg1 │
418       │                                       │                                                             g    │
419       │                                       │                                                                  │
420       │                                       │                                                                  │
421       │                                       │                                                         -        │
422       │                                       │                                                         0.5      │
423       │                                       │                                                                  │
424       │                                       │                                                                  │
425       │                                       │                                                                  │
426       │                                       │                                                                  │
427       │                                       │                                         +                        │
428       │                                       │                                                                  │
429       │                                       │                                                                  │
430       │                                       │                                                                  │
431       │                                       │                                                                  │
432       │                                       │                                                                  │
433       │                                       │                                                             Arg0 │
434       │                                       │                                                             b    │
435       │                                       │                                                                  │
436       │                                       │                                                                  │
437       │                                       │                                                         -        │
438       │                                       │                                                         0.5      │
439       │                                       │                                                                  │
440       │                                       │                                                                  │
441       │                                       │                                                 ×                │
442       │                                       │                                                                  │
443       │                                       │                                                                  │
444       │                                       │                                                                  │
445       │                                       │                                                             Arg1 │
446       │                                       │                                                             b    │
447       │                                       │                                                                  │
448       │                                       │                                                                  │
449       │                                       │                                                         -        │
450       │                                       │                                                         0.5      │
451       └───────────────────────────────────────┴──────────────────────────────────────────────────────────────────┘
452
453       The scalar results for GL_DOT3_RGB and GL_DOT3_RGBA are placed into
454       each of the 3 (RGB) or 4 (RGBA) components on output.
455
456       Likewise, GL_COMBINE_ALPHA accepts any of GL_REPLACE, GL_MODULATE,
457       GL_ADD, GL_ADD_SIGNED, GL_INTERPOLATE, or GL_SUBTRACT. The following
458       table describes how alpha values are combined:
459
460       ┌─────────────────────────────────────────┬──────────────────────────────────────────────────┐
461       │                                         │                                                  │
462GL_COMBINE_ALPHA Texture                  
463       │                                         │ Function                                         
464       │                                         │                                                  │
465       ├─────────────────────────────────────────┼──────────────────────────────────────────────────┤
466GL_REPLACE                               │ Arg0                                             │
467       ├─────────────────────────────────────────┼──────────────────────────────────────────────────┤
468GL_MODULATE                              │ Arg0                                             │
469       │                                         │                                 ×                │
470       │                                         │                                 Arg1             │
471       ├─────────────────────────────────────────┼──────────────────────────────────────────────────┤
472GL_ADD                                   │ Arg0                                             │
473       │                                         │                                 +                │
474       │                                         │                                 Arg1             │
475       ├─────────────────────────────────────────┼──────────────────────────────────────────────────┤
476GL_ADD_SIGNED                            │ Arg0                                             │
477       │                                         │                                 +                │
478       │                                         │                                 Arg1             │
479       │                                         │                                 -                │
480       │                                         │                                 0.5              │
481       ├─────────────────────────────────────────┼──────────────────────────────────────────────────┤
482GL_INTERPOLATE                           │ Arg0                                             │
483       │                                         │                                     ×            │
484       │                                         │                                     Arg2         │
485       │                                         │                                                  │
486       │                                         │                                 +                │
487       │                                         │                                                  │
488       │                                         │                                     Arg1         │
489       │                                         │                                     ×            │
490       │                                         │                                                  │
491       │                                         │                                                  │
492       │                                         │                                             1    │
493       │                                         │                                             -    │
494       │                                         │                                             Arg2 │
495       ├─────────────────────────────────────────┼──────────────────────────────────────────────────┤
496GL_SUBTRACT                              │ Arg0                                             │
497       │                                         │                                 -                │
498       │                                         │                                 Arg1             │
499       └─────────────────────────────────────────┴──────────────────────────────────────────────────┘
500
501       In the following tables, the value C s represents the color sampled
502       from the currently bound texture, C c represents the constant
503       texture-environment color, C f represents the primary color of the
504       incoming fragment, and C p represents the color computed from the
505       previous texture stage or C f if processing texture stage 0. Likewise,
506       A s, A c, A f, and A p represent the respective alpha values.
507
508       The following table describes the values assigned to Arg0, Arg1, and
509       Arg2 based upon the RGB sources and operands:
510
511       ┌────────────────────────────────────┬─────────────────────────────────────────┬───────────────────────────────────────┐
512       │                                    │                                         │                                       │
513GL_SRCn_RGB GL_OPERANDn_RGB Argument    
514       │                                    │                                         │   Value                               
515       │                                    │                                         │                                       │
516       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
517GL_TEXTURE                          GL_SRC_COLOR                            │   C                                   │
518       │                                    │                                         │                                   s   │
519       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
520       │                                    │ GL_ONE_MINUS_SRC_COLOR                  │ 1                                     │
521       │                                    │                                         │                                 -     │
522       │                                    │                                         │                                       │
523       │                                    │                                         │                                     C │
524       │                                    │                                         │                                     s │
525       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
526       │                                    │ GL_SRC_ALPHA                            │   A                                   │
527       │                                    │                                         │                                   s   │
528       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
529       │                                    │ GL_ONE_MINUS_SRC_ALPHA                  │ 1                                     │
530       │                                    │                                         │                                 -     │
531       │                                    │                                         │                                       │
532       │                                    │                                         │                                     A │
533       │                                    │                                         │                                     s │
534       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
535GL_TEXTUREn                         GL_SRC_COLOR                            │   C                                   │
536       │                                    │                                         │                                   s   │
537       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
538       │                                    │ GL_ONE_MINUS_SRC_COLOR                  │ 1                                     │
539       │                                    │                                         │                                 -     │
540       │                                    │                                         │                                       │
541       │                                    │                                         │                                     C │
542       │                                    │                                         │                                     s │
543       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
544       │                                    │ GL_SRC_ALPHA                            │   A                                   │
545       │                                    │                                         │                                   s   │
546       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
547       │                                    │ GL_ONE_MINUS_SRC_ALPHA                  │ 1                                     │
548       │                                    │                                         │                                 -     │
549       │                                    │                                         │                                       │
550       │                                    │                                         │                                     A │
551       │                                    │                                         │                                     s │
552       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
553GL_CONSTANT                         GL_SRC_COLOR                            │   C                                   │
554       │                                    │                                         │                                   c   │
555       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
556       │                                    │ GL_ONE_MINUS_SRC_COLOR                  │ 1                                     │
557       │                                    │                                         │                                 -     │
558       │                                    │                                         │                                       │
559       │                                    │                                         │                                     C │
560       │                                    │                                         │                                     c │
561       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
562       │                                    │ GL_SRC_ALPHA                            │   A                                   │
563       │                                    │                                         │                                   c   │
564       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
565       │                                    │ GL_ONE_MINUS_SRC_ALPHA                  │ 1                                     │
566       │                                    │                                         │                                 -     │
567       │                                    │                                         │                                       │
568       │                                    │                                         │                                     A │
569       │                                    │                                         │                                     c │
570       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
571GL_PRIMARY_COLOR                    GL_SRC_COLOR                            │   C                                   │
572       │                                    │                                         │                                   f   │
573       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
574       │                                    │ GL_ONE_MINUS_SRC_COLOR                  │ 1                                     │
575       │                                    │                                         │                                 -     │
576       │                                    │                                         │                                       │
577       │                                    │                                         │                                     C │
578       │                                    │                                         │                                     f │
579       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
580       │                                    │ GL_SRC_ALPHA                            │   A                                   │
581       │                                    │                                         │                                   f   │
582       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
583       │                                    │ GL_ONE_MINUS_SRC_ALPHA                  │ 1                                     │
584       │                                    │                                         │                                 -     │
585       │                                    │                                         │                                       │
586       │                                    │                                         │                                     A │
587       │                                    │                                         │                                     f │
588       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
589GL_PREVIOUS                         GL_SRC_COLOR                            │   C                                   │
590       │                                    │                                         │                                   p   │
591       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
592       │                                    │ GL_ONE_MINUS_SRC_COLOR                  │ 1                                     │
593       │                                    │                                         │                                 -     │
594       │                                    │                                         │                                       │
595       │                                    │                                         │                                     C │
596       │                                    │                                         │                                     p │
597       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
598       │                                    │ GL_SRC_ALPHA                            │   A                                   │
599       │                                    │                                         │                                   p   │
600       ├────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────┤
601       │                                    │ GL_ONE_MINUS_SRC_ALPHA                  │ 1                                     │
602       │                                    │                                         │                                 -     │
603       │                                    │                                         │                                       │
604       │                                    │                                         │                                     A │
605       │                                    │                                         │                                     p │
606       └────────────────────────────────────┴─────────────────────────────────────────┴───────────────────────────────────────┘
607
608       For GL_TEXTUREn sources, C s and A s represent the color and alpha,
609       respectively, produced from texture stage n.
610
611       The follow table describes the values assigned to Arg0, Arg1, and Arg2
612       based upon the alpha sources and operands:
613
614       ┌──────────────────────────────────────┬───────────────────────────────────────────┬───────────────────────────────────────┐
615       │                                      │                                           │                                       │
616GL_SRCn_ALPHA GL_OPERANDn_ALPHA Argument    
617       │                                      │                                           │   Value                               
618       │                                      │                                           │                                       │
619       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
620GL_TEXTURE                            GL_SRC_ALPHA                              │   A                                   │
621       │                                      │                                           │                                   s   │
622       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
623       │                                      │ GL_ONE_MINUS_SRC_ALPHA                    │ 1                                     │
624       │                                      │                                           │                                 -     │
625       │                                      │                                           │                                       │
626       │                                      │                                           │                                     A │
627       │                                      │                                           │                                     s │
628       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
629GL_TEXTUREn                           GL_SRC_ALPHA                              │   A                                   │
630       │                                      │                                           │                                   s   │
631       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
632       │                                      │ GL_ONE_MINUS_SRC_ALPHA                    │ 1                                     │
633       │                                      │                                           │                                 -     │
634       │                                      │                                           │                                       │
635       │                                      │                                           │                                     A │
636       │                                      │                                           │                                     s │
637       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
638GL_CONSTANT                           GL_SRC_ALPHA                              │   A                                   │
639       │                                      │                                           │                                   c   │
640       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
641       │                                      │ GL_ONE_MINUS_SRC_ALPHA                    │ 1                                     │
642       │                                      │                                           │                                 -     │
643       │                                      │                                           │                                       │
644       │                                      │                                           │                                     A │
645       │                                      │                                           │                                     c │
646       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
647GL_PRIMARY_COLOR                      GL_SRC_ALPHA                              │   A                                   │
648       │                                      │                                           │                                   f   │
649       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
650       │                                      │ GL_ONE_MINUS_SRC_ALPHA                    │ 1                                     │
651       │                                      │                                           │                                 -     │
652       │                                      │                                           │                                       │
653       │                                      │                                           │                                     A │
654       │                                      │                                           │                                     f │
655       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
656GL_PREVIOUS                           GL_SRC_ALPHA                              │   A                                   │
657       │                                      │                                           │                                   p   │
658       ├──────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
659       │                                      │ GL_ONE_MINUS_SRC_ALPHA                    │ 1                                     │
660       │                                      │                                           │                                 -     │
661       │                                      │                                           │                                       │
662       │                                      │                                           │                                     A │
663       │                                      │                                           │                                     p │
664       └──────────────────────────────────────┴───────────────────────────────────────────┴───────────────────────────────────────┘
665
666       The RGB and alpha results of the texture function are multipled by the
667       values of GL_RGB_SCALE and GL_ALPHA_SCALE, respectively, and clamped to
668       the range 0 1.
669
670       If pname is GL_TEXTURE_ENV_COLOR, params is a pointer to an array that
671       holds an RGBA color consisting of four values. Integer color components
672       are interpreted linearly such that the most positive integer maps to
673       1.0, and the most negative integer maps to -1.0. The values are clamped
674       to the range [0,1] when they are specified.  C c takes these four
675       values.
676
677       If pname is GL_TEXTURE_LOD_BIAS, the value specified is added to the
678       texture level-of-detail parameter, that selects which mipmap, or
679       mipmaps depending upon the selected GL_TEXTURE_MIN_FILTER, will be
680       sampled.
681
682       GL_TEXTURE_ENV_MODE defaults to GL_MODULATE and GL_TEXTURE_ENV_COLOR
683       defaults to (0, 0, 0, 0).
684
685       If target is GL_POINT_SPRITE and pname is GL_COORD_REPLACE, the boolean
686       value specified is used to either enable or disable point sprite
687       texture coordinate replacement. The default value is GL_FALSE.
688

NOTES

690       GL_REPLACE may only be used if the GL version is 1.1 or greater.
691
692       GL_TEXTURE_FILTER_CONTROL and GL_TEXTURE_LOD_BIAS may only be used if
693       the GL version is 1.4 or greater.
694
695       GL_COMBINE mode and its associated constants may only be used if the GL
696       version is 1.3 or greater.
697
698       GL_TEXTUREn may only be used if the GL version is 1.4 or greater.
699
700       Internal formats other than 1, 2, 3, or 4 may only be used if the GL
701       version is 1.1 or greater.
702
703       For OpenGL versions 1.3 and greater, or when the ARB_multitexture
704       extension is supported, glTexEnv controls the texture environment for
705       the current active texture unit, selected by glActiveTexture().
706
707       GL_POINT_SPRITE and GL_COORD_REPLACE are available only if the GL
708       version is 2.0 or greater.
709

ERRORS

711       GL_INVALID_ENUM is generated when target or pname is not one of the
712       accepted defined values, or when params should have a defined constant
713       value (based on the value of pname) and does not.
714
715       GL_INVALID_VALUE is generated if the params value for GL_RGB_SCALE or
716       GL_ALPHA_SCALE are not one of 1.0, 2.0, or 4.0.
717
718       GL_INVALID_OPERATION is generated if glTexEnv is executed between the
719       execution of glBegin() and the corresponding execution of glEnd().
720

ASSOCIATED GETS

722       glGetTexEnv()
723

SEE ALSO

725       glActiveTexture(), glCopyPixels(), glCopyTexImage1D(),
726       glCopyTexImage2D(), glCopyTexSubImage1D(), glCopyTexSubImage2D(),
727       glCopyTexSubImage3D(), glTexImage1D(), glTexImage2D(), glTexImage3D(),
728       glTexParameter(), glTexSubImage1D(), glTexSubImage2D(),
729       glTexSubImage3D()
730
732       Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
733       under the SGI Free Software B License. For details, see
734       http://oss.sgi.com/projects/FreeB/.
735

AUTHORS

737       opengl.org
738
739
740
741opengl.org                        06/10/2014                      GLTEXENV(3G)
Impressum