summaryrefslogtreecommitdiff
path: root/doc/gl-docs/GL/gl/texenv.3gl
blob: 171f78e5ca998c0ad2238110484cf223b3a3ebc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
'\" te
'\"! tbl|eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 texenv.gl
.ds Xs 19951 8 texenv.gl
.TH GLTEXENV 3G
.SH NAME
.B "glTexEnvf, glTexEnvi, glTexEnvfv, glTexEnviv
\- set texture environment parameters

.SH C SPECIFICATION
void \f3glTexEnvf\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglTexEnvf( 'u
	GLenum \fIpname\fP,
	GLfloat \fIparam\fP )
.fi
void \f3glTexEnvi\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglTexEnvi( 'u
	GLenum \fIpname\fP,
	GLint \fIparam\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2target\fP\ \ 'u 
\f2target\fP
Specifies a texture environment.
Must be \%\f3GL_TEXTURE_ENV\fP.
.TP
\f2pname\fP
Specifies the symbolic name of a single-valued texture environment parameter.
Must be \%\f3GL_TEXTURE_ENV_MODE\fP.
.TP
\f2param\fP
Specifies a single symbolic constant, one of \%\f3GL_MODULATE\fP, 
\%\f3GL_DECAL\fP, \%\f3GL_BLEND\fP, or \%\f3GL_REPLACE\fP.
.SH C SPECIFICATION
void \f3glTexEnvfv\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglTexEnvfv( 'u
	GLenum \fIpname\fP,
	const GLfloat \fI*params\fP )
.fi
void \f3glTexEnviv\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglTexEnviv( 'u
	GLenum \fIpname\fP,
	const GLint \fI*params\fP )
.fi

.SH PARAMETERS
.TP
\f2target\fP
Specifies a texture environment.
Must be \%\f3GL_TEXTURE_ENV\fP.
.TP
\f2pname\fP
Specifies the symbolic name of a texture environment parameter.
Accepted values are \%\f3GL_TEXTURE_ENV_MODE\fP and \%\f3GL_TEXTURE_ENV_COLOR\fP.
.TP
\f2params\fP
Specifies a pointer to a parameter array that contains
either a single symbolic constant or an RGBA color.
.SH DESCRIPTION
A texture environment specifies how texture values are interpreted
when a fragment is textured.
\f2target\fP must be \%\f3GL_TEXTURE_ENV\fP.
\f2pname\fP can be either \%\f3GL_TEXTURE_ENV_MODE\fP or \%\f3GL_TEXTURE_ENV_COLOR\fP.
.P
If \f2pname\fP is \%\f3GL_TEXTURE_ENV_MODE\fP,
then \f2params\fP is (or points to) the symbolic name of a texture function.
Four texture functions may be specified:
\%\f3GL_MODULATE\fP, 
\%\f3GL_DECAL\fP, 
\%\f3GL_BLEND\fP, and
\%\f3GL_REPLACE\fP.
.P
A texture function acts on the fragment to be textured using
the texture image value that applies to the fragment
(see \%\f3glTexParameter\fP)
and produces an RGBA color for that fragment.
The following table shows how the RGBA color is produced for each
of the three texture functions that can be chosen.
$C$ is a triple of color values (RGB) and $A$ is the associated alpha value.
RGBA values extracted from a texture image are in the range [0,1].
The subscript $f$ refers to the incoming fragment,
the subscript $t$ to the texture image,
the subscript $c$ to the texture environment color,
and subscript $v$ indicates a value produced by the texture function.
.P
A texture image can have up to four components per texture element
(see \%\f3glTexImage1D\fP, \%\f3glTexImage2D\fP, \%\f3glTexImage3D\fP,
\%\f3glCopyTexImage1D\fP, and \%\f3glCopyTexImage2D\fP). 
In a one-component image,
$L sub t$ indicates that single component.
A two-component image uses $L sub t$ and $A sub t$.
A three-component image has only a color value, $C sub t$.
A four-component image has both a color value $C sub t$
and an alpha value $A sub t$.
.sp
.ne
.TS
center tab(:) ;
cb cb s s s
ci c c c c
c c c c c.
_
Base internal:Texture functions       
:\%\f3GL_MODULATE\fP:\%\f3GL_DECAL\fP:\%\f3GL_BLEND\fP:\%\f3GL_REPLACE\fP
_
\%\f3GL_ALPHA\fP:$C sub v ~=~ C sub f$:undefined:$C sub v ~=~  C sub f$:$C sub v ~=~ C sub f$
\^ :$A sub v ~=~ A sub f A sub t$:\^:$A sub v ~=~ A sub f$:$A sub v ~=~ A sub t$
_
\%\f3GL_LUMINANCE\fP:$C sub v ~=~ L sub t C sub f$:undefined:$C sub v ~=~ ( 1 - L sub t ) C sub f$:$C sub v ~=~ L sub t$
: : :$+ L sub t C sub c$:
1: $A sub v ~=~ A sub f$:\^: $A sub v ~=~ A sub f$:$A sub v ~=~ A sub f$
_
\%\f3GL_LUMINANCE\fP:$C sub v ~=~ L sub t C sub f$:undefined:$C sub v ~=~ ( 1 - L sub t ) C sub f $:$C sub v ~=~ L sub t$
\\f3_ALPHA\fP: : : $+ L sub t C sub c$
2:$A sub v ~=~ A sub t A sub f$:\^:$A sub v ~=~ A sub t A sub f$:$A sub v ~=~ A sub t$
_
\%\f3GL_INTENSITY\fP:$C sub v ~=~ C sub f I sub t$:undefined:$C sub v ~=~ ( 1 - I sub t ) C sub f$ :$C sub v ~=~ I sub t$
: : :$+ I sub t C sub c$
c\^ :$A sub v ~=~ A sub f I sub t$:\^:$A sub v ~=~ ( 1 - I sub t ) A sub f $:$A sub v ~=~ I sub t$
: : :$+ I sub t A sub c$:
_
\%\f3GL_RGB\fP:$C sub v ~=~ C sub t C sub f$:$C sub v ~=~ C sub t$:$C sub v ~=~ (1 - C sub t) C sub f $:$C sub v ~=~ C sub t$
: : : $+ C sub t C sub c$
3:$A sub v ~=~ A sub f$:$A sub v ~=~ A sub f$:$A sub v ~=~ A sub f$:$A sub v ~=~ A sub f$
_
\%\f3GL_RGBA\fP:$C sub v ~=~ C sub t C sub f$:$C sub v ~=~ ( 1 - A sub t ) C sub f $:$C sub v ~=~ (1 - C sub t) C sub f $:$C sub v ~=~ C sub t$
: :$+ A sub t C sub t$: $+ C sub t C sub c$
4:$A sub v ~=~ A sub t A sub f$:$A sub v ~=~ A sub f$:$A sub v ~=~ A sub t A sub f$:$A sub v ~=~ A sub t$
_
.TE
.bp
If \f2pname\fP is \%\f3GL_TEXTURE_ENV_COLOR\fP,
\f2params\fP is a pointer to an array that holds an RGBA color consisting of four
values.
Integer color components are interpreted linearly such that the most
positive integer maps to 1.0,
and the most negative integer maps to -1.0.
The values are clamped to the range [0,1] when they are specified.
$C sub c$ takes these four values.
.P
\%\f3GL_TEXTURE_ENV_MODE\fP defaults to \%\f3GL_MODULATE\fP and
\%\f3GL_TEXTURE_ENV_COLOR\fP defaults to (0, 0, 0, 0).
.SH NOTES
\%\f3GL_REPLACE\fP may only be used if the GL version is 1.1 or greater.
.P
Internal formats other than 1, 2, 3, or 4 may only be used if the GL
version is 1.1 or greater.
.P
When the \%\f3GL_ARB_multitexture\fP extension is supported, \%\f3glTexEnv\fP controls 
the texture environment for the current active texture unit, selected by 
\%\f3glActiveTextureARB\fP.
.sh ERRORS
\%\f3GL_INVALID_ENUM\fP is generated when \f2target\fP or \f2pname\fP is not
one of the accepted defined values,
or when \f2params\fP should have a defined constant value
(based on the value of \f2pname\fP)
and does not.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glTexEnv\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGetTexEnv\fP
.SH SEE ALSO
\%\f3glActiveTextureARB(3G)\fP,
\%\f3glCopyPixels(3G)\fP,
\%\f3glCopyTexImage1D(3G)\fP,
\%\f3glCopyTexImage2D(3G)\fP,
\%\f3glCopyTexSubImage1D(3G)\fP,
\%\f3glCopyTexSubImage2D(3G)\fP,
\%\f3glCopyTexSubImage3D(3G)\fP,
\%\f3glTexImage1D(3G)\fP,
\%\f3glTexImage2D(3G)\fP,
\%\f3glTexImage3D(3G)\fP,
\%\f3glTexParameter(3G)\fP,
\%\f3glTexSubImage1D(3G)\fP,
\%\f3glTexSubImage2D(3G)\fP,
\%\f3glTexSubImage3D(3G)\fP