1GLPIXELTRANSFER(3G) GLPIXELTRANSFER(3G)
2
3
4
6 glPixelTransferf, glPixelTransferi - set pixel transfer modes
7
8
10 void glPixelTransferf( GLenum pname,
11 GLfloat param )
12 void glPixelTransferi( GLenum pname,
13 GLint param )
14
15 delim $$
16
18 pname Specifies the symbolic name of the pixel transfer parameter to
19 be set. Must be one of the following: GL_MAP_COLOR,
20 GL_MAP_STENCIL, GL_INDEX_SHIFT, GL_INDEX_OFFSET, GL_RED_SCALE,
21 GL_RED_BIAS, GL_GREEN_SCALE, GL_GREEN_BIAS, GL_BLUE_SCALE,
22 GL_BLUE_BIAS, GL_ALPHA_SCALE, GL_ALPHA_BIAS, GL_DEPTH_SCALE, or
23 GL_DEPTH_BIAS.
24
25 Additionally, if the GL_ARB_imaging extension is supported, the
26 following symbolic names are accepted:
27 GL_POST_COLOR_MATRIX_RED_SCALE,
28 GL_POST_COLOR_MATRIX_GREEN_SCALE,
29 GL_POST_COLOR_MATRIX_BLUE_SCALE,
30 GL_POST_COLOR_MATRIX_ALPHA_SCALE, GL_POST_COLOR_MATRIX_RED_BIAS,
31 GL_POST_COLOR_MATRIX_GREEN_BIAS, GL_POST_COLOR_MATRIX_BLUE_BIAS,
32 GL_POST_COLOR_MATRIX_ALPHA_BIAS, GL_POST_CONVOLUTION_RED_SCALE,
33 GL_POST_CONVOLUTION_GREEN_SCALE, GL_POST_CONVOLUTION_BLUE_SCALE,
34 GL_POST_CONVOLUTION_ALPHA_SCALE, GL_POST_CONVOLUTION_RED_BIAS,
35 GL_POST_CONVOLUTION_GREEN_BIAS, GL_POST_CONVOLUTION_BLUE_BIAS,
36 and GL_POST_CONVOLUTION_ALPHA_BIAS.
37
38 param Specifies the value that pname is set to.
39
41 glPixelTransfer sets pixel transfer modes that affect the operation of
42 subsequent glCopyPixels, glCopyTexImage1D, glCopyTexImage2D,
43 glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D,
44 glDrawPixels, glReadPixels, glTexImage1D, glTexImage2D, glTexImage3D,
45 glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D commands. Addi‐
46 tionally, if the GL_ARB_imaging subset is supported, the routines
47 glColorTable, glColorSubTable, glConvolutionFilter1D,
48 glConvolutionFilter2D, glHistogram, glMinmax, and glSeparableFilter2D
49 are also affected. The algorithms that are specified by pixel transfer
50 modes operate on pixels after they are read from the frame buffer (‐
51 glCopyPixels glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D,
52 glCopyTexSubImage2D, glCopyTexSubImage3D, and glReadPixels), or
53 unpacked from client memory (glDrawPixels, glTexImage1D, glTexImage2D,
54 glTexImage3D, glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D).
55 Pixel transfer operations happen in the same order, and in the same
56 manner, regardless of the command that resulted in the pixel operation.
57 Pixel storage modes (see glPixelStore) control the unpacking of pixels
58 being read from client memory, and the packing of pixels being written
59 back into client memory.
60
61 Pixel transfer operations handle four fundamental pixel types: color,
62 color index, depth, and stencil. Color pixels consist of four float‐
63 ing-point values with unspecified mantissa and exponent sizes, scaled
64 such that 0 represents zero intensity and 1 represents full intensity.
65 Color indices comprise a single fixed-point value, with unspecified
66 precision to the right of the binary point. Depth pixels comprise a
67 single floating-point value, with unspecified mantissa and exponent
68 sizes, scaled such that 0.0 represents the minimum depth buffer value,
69 and 1.0 represents the maximum depth buffer value. Finally, stencil
70 pixels comprise a single fixed-point value, with unspecified precision
71 to the right of the binary point.
72
73 The pixel transfer operations performed on the four basic pixel types
74 are as follows:
75
76 Color Each of the four color components is multiplied by a scale
77 factor, then added to a bias factor. That is, the red com‐
78 ponent is multiplied by GL_RED_SCALE, then added to
79 GL_RED_BIAS; the green component is multiplied by
80 GL_GREEN_SCALE, then added to GL_GREEN_BIAS; the blue com‐
81 ponent is multiplied by GL_BLUE_SCALE, then added to
82 GL_BLUE_BIAS; and the alpha component is multiplied by
83 GL_ALPHA_SCALE, then added to GL_ALPHA_BIAS. After all
84 four color components are scaled and biased, each is
85 clamped to the range [0,1]. All color, scale, and bias
86 values are specified with glPixelTransfer.
87
88 If GL_MAP_COLOR is true, each color component is scaled by
89 the size of the corresponding color-to-color map, then
90 replaced by the contents of that map indexed by the scaled
91 component. That is, the red component is scaled by
92 GL_PIXEL_MAP_R_TO_R_SIZE, then replaced by the contents of
93 GL_PIXEL_MAP_R_TO_R indexed by itself. The green component
94 is scaled by GL_PIXEL_MAP_G_TO_G_SIZE, then replaced by the
95 contents of GL_PIXEL_MAP_G_TO_G indexed by itself. The
96 blue component is scaled by GL_PIXEL_MAP_B_TO_B_SIZE, then
97 replaced by the contents of GL_PIXEL_MAP_B_TO_B indexed by
98 itself. And the alpha component is scaled by
99 GL_PIXEL_MAP_A_TO_A_SIZE, then replaced by the contents of
100 GL_PIXEL_MAP_A_TO_A indexed by itself. All components
101 taken from the maps are then clamped to the range [0,1].
102 GL_MAP_COLOR is specified with glPixelTransfer. The con‐
103 tents of the various maps are specified with glPixelMap.
104
105 If the GL_ARB_imaging extension is supported, each of the
106 four color components may be scaled and biased after trans‐
107 formation by the color matrix. That is, the red component
108 is multiplied by GL_POST_COLOR_MATRIX_RED_SCALE, then added
109 to GL_POST_COLOR_MATRIX_RED_BIAS; the green component is
110 multiplied by GL_POST_COLOR_MATRIX_GREEN_SCALE, then added
111 to GL_POST_COLOR_MATRIX_GREEN_BIAS; the blue component is
112 multiplied by GL_POST_COLOR_MATRIX_BLUE_SCALE, then added
113 to GL_POST_COLOR_MATRIX_BLUE_BIAS; and the alpha component
114 is multiplied by GL_POST_COLOR_MATRIX_ALPHA_SCALE, then
115 added to GL_POST_COLOR_MATRIX_ALPHA_BIAS. After all four
116 color components are scaled and biased, each is clamped to
117 the range [0,1].
118
119 Similiarly, if the GL_ARB_imaging extension is supported,
120 each of the four color components may be scaled and biased
121 after processing by the enabled convolution filter. That
122 is, the red component is multiplied by
123 GL_POST_CONVOLUTION_RED_SCALE, then added to
124 GL_POST_CONVOLUTION_RED_BIAS; the green component is multi‐
125 plied by GL_POST_CONVOLUTION_GREEN_SCALE, then added to
126 GL_POST_CONVOLUTION_GREEN_BIAS; the blue component is mul‐
127 tiplied by GL_POST_CONVOLUTION_BLUE_SCALE, then added to
128 GL_POST_CONVOLUTION_BLUE_BIAS; and the alpha component is
129 multiplied by GL_POST_CONVOLUTION_ALPHA_SCALE, then added
130 to GL_POST_CONVOLUTION_ALPHA_BIAS. After all four color
131 components are scaled and biased, each is clamped to the
132 range [0,1].
133
134 Color index Each color index is shifted left by GL_INDEX_SHIFT bits;
135 any bits beyond the number of fraction bits carried by the
136 fixed-point index are filled with zeros. If GL_INDEX_SHIFT
137 is negative, the shift is to the right, again zero filled.
138 Then GL_INDEX_OFFSET is added to the index. GL_INDEX_SHIFT
139 and GL_INDEX_OFFSET are specified with
140 glPixelTransfer.
141
142 From this point, operation diverges depending on the
143 required of the resulting pixels. If the resulting pixels
144 are to be written to a color index buffer, or if they are
145 being read back to client memory in GL_COLOR_INDEX , the
146 pixels continue to be treated as indices. If GL_MAP_COLOR
147 is true, each index is masked by $2 sup n ~-~ 1$, where $n$
148 is GL_PIXEL_MAP_I_TO_I_SIZE, then replaced by the contents
149 of GL_PIXEL_MAP_I_TO_I indexed by the masked value.
150 GL_MAP_COLOR is specified with glPixelTransfer. The con‐
151 tents of the index map is specified with glPixelMap.
152
153 If the resulting pixels are to be written to an RGBA color
154 buffer, or if they are read back to client memory in a
155 other than GL_COLOR_INDEX, the pixels are converted from
156 indices to colors by referencing the four maps
157 GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_G,
158 GL_PIXEL_MAP_I_TO_B, and GL_PIXEL_MAP_I_TO_A. Before being
159 dereferenced, the index is masked by $2 sup n ~-~ 1$, where
160 $n$ is GL_PIXEL_MAP_I_TO_R_SIZE for the red map,
161 GL_PIXEL_MAP_I_TO_G_SIZE for the green map,
162 GL_PIXEL_MAP_I_TO_B_SIZE for the blue map, and
163 GL_PIXEL_MAP_I_TO_A_SIZE for the alpha map. All components
164 taken from the maps are then clamped to the range [0,1].
165 The contents of the four maps is specified with glPixelMap.
166
167 Depth Each depth value is multiplied by GL_DEPTH_SCALE, added to
168 GL_DEPTH_BIAS, then clamped to the range [0,1].
169
170 Stencil Each index is shifted GL_INDEX_SHIFT bits just as a color
171 index is, then added to GL_INDEX_OFFSET. If GL_MAP_STENCIL
172 is true, each index is masked by $2 sup n ~-~ 1$, where $n$
173 is GL_PIXEL_MAP_S_TO_S_SIZE, then replaced by the contents
174 of GL_PIXEL_MAP_S_TO_S indexed by the masked value.
175
176 The following table gives the type, initial value, and range of valid
177 values for each of the pixel transfer parameters that are set with
178 glPixelTransfer.
179
180
181
182 ─────────────────────────────────────────────────────────────────────────
183 pname Type Initial Value Valid Range
184 ─────────────────────────────────────────────────────────────────────────
185 GL_MAP_COLOR boolean false true/false
186 GL_MAP_STENCIL boolean false true/false
187 GL_INDEX_SHIFT integer 0 (-∞,∞)
188 GL_INDEX_OFFSET integer 0 (-∞,∞)
189 GL_RED_SCALE float 1 (-∞,∞)
190 GL_GREEN_SCALE float 1 (-∞,∞)
191 GL_BLUE_SCALE float 1 (-∞,∞)
192 GL_ALPHA_SCALE float 1 (-∞,∞)
193 GL_DEPTH_SCALE float 1 (-∞,∞)
194 GL_RED_BIAS float 0 (-∞,∞)
195 GL_GREEN_BIAS float 0 (-∞,∞)
196 GL_BLUE_BIAS float 0 (-∞,∞)
197 GL_ALPHA_BIAS float 0 (-∞,∞)
198
199 GL_DEPTH_BIAS float 0 (-∞,∞)
200 GL_POST_COLOR_MATRIX_RED_SCALE float 1 (-∞,∞)
201 GL_POST_COLOR_MATRIX_GREEN_SCALE float 1 (-∞,∞)
202 GL_POST_COLOR_MATRIX_BLUE_SCALE float 1 (-∞,∞)
203 GL_POST_COLOR_MATRIX_ALPHA_SCALE float 1 (-∞,∞)
204 GL_POST_COLOR_MATRIX_RED_BIAS float 0 (-∞,∞)
205 GL_POST_COLOR_MATRIX_GREEN_BIAS float 0 (-∞,∞)
206 GL_POST_COLOR_MATRIX_BLUE_BIAS float 0 (-∞,∞)
207 GL_POST_COLOR_MATRIX_ALPHA_BIAS float 0 (-∞,∞)
208 GL_POST_CONVOLUTION_RED_SCALE float 1 (-∞,∞)
209 GL_POST_CONVOLUTION_GREEN_SCALE float 1 (-∞,∞)
210 GL_POST_CONVOLUTION_BLUE_SCALE float 1 (-∞,∞)
211 GL_POST_CONVOLUTION_ALPHA_SCALE float 1 (-∞,∞)
212 GL_POST_CONVOLUTION_RED_BIAS float 0 (-∞,∞)
213 GL_POST_CONVOLUTION_GREEN_BIAS float 0 (-∞,∞)
214 GL_POST_CONVOLUTION_BLUE_BIAS float 0 (-∞,∞)
215 GL_POST_CONVOLUTION_ALPHA_BIAS float 0 (-∞,∞)
216 ─────────────────────────────────────────────────────────────────────────
217
218
219 glPixelTransferf can be used to set any pixel transfer parameter. If
220 the parameter type is boolean, 0 implies false and any other value
221 implies true. If pname is an integer parameter, param is rounded to
222 the nearest integer.
223
224 Likewise, glPixelTransferi can be used to set any of the pixel transfer
225 parameters. Boolean parameters are set to false if param is 0 and to
226 true otherwise. param is converted to floating point before being
227 assigned to real-valued parameters.
228
230 If a glColorTable, glColorSubTable, glConvolutionFilter1D,
231 glConvolutionFilter2D, glCopyPixels, glCopyTexImage1D,
232 glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D,
233 glCopyTexSubImage3D, glDrawPixels, glReadPixels, glSeparableFilter2D,
234 glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D,
235 glTexSubImage2D, or glTexSubImage3D. command is placed in a display
236 list (see glNewList and glCallList), the pixel transfer mode settings
237 in effect when the display list is executed are the ones that are used.
238 They may be different from the settings when the command was compiled
239 into the display list.
240
242 GL_INVALID_ENUM is generated if pname is not an accepted value.
243
244 GL_INVALID_OPERATION is generated if glPixelTransfer is executed
245 between the execution of glBegin and the corresponding execution of
246 glEnd.
247
249 glGet with argument GL_MAP_COLOR
250 glGet with argument GL_MAP_STENCIL
251 glGet with argument GL_INDEX_SHIFT
252 glGet with argument GL_INDEX_OFFSET
253 glGet with argument GL_RED_SCALE
254 glGet with argument GL_RED_BIAS
255 glGet with argument GL_GREEN_SCALE
256 glGet with argument GL_GREEN_BIAS
257 glGet with argument GL_BLUE_SCALE
258 glGet with argument GL_BLUE_BIAS
259 glGet with argument GL_ALPHA_SCALE
260 glGet with argument GL_ALPHA_BIAS
261 glGet with argument GL_DEPTH_SCALE
262 glGet with argument GL_DEPTH_BIAS
263 glGet with argument GL_POST_COLOR_MATRIX_RED_SCALE
264 glGet with argument GL_POST_COLOR_MATRIX_RED_BIAS
265 glGet with argument GL_POST_COLOR_MATRIX_GREEN_SCALE
266 glGet with argument GL_POST_COLOR_MATRIX_GREEN_BIAS
267 glGet with argument GL_POST_COLOR_MATRIX_BLUE_SCALE
268 glGet with argument GL_POST_COLOR_MATRIX_BLUE_BIAS
269 glGet with argument GL_POST_COLOR_MATRIX_ALPHA_SCALE
270 glGet with argument GL_POST_COLOR_MATRIX_ALPHA_BIAS
271 glGet with argument GL_POST_CONVOLUTION_RED_SCALE
272 glGet with argument GL_POST_CONVOLUTION_RED_BIAS
273 glGet with argument GL_POST_CONVOLUTION_GREEN_SCALE
274 glGet with argument GL_POST_CONVOLUTION_GREEN_BIAS
275 glGet with argument GL_POST_CONVOLUTION_BLUE_SCALE
276 glGet with argument GL_POST_CONVOLUTION_BLUE_BIAS
277 glGet with argument GL_POST_CONVOLUTION_ALPHA_SCALE
278 glGet with argument GL_POST_CONVOLUTION_ALPHA_BIAS
279
281 glCallList(3G), glColorTable(3G), glColorSubTable(3G),
282 glConvolutionFilter1D(3G), glConvolutionFilter2D(3G), glCopyPixels(3G),
283 glCopyTexImage1D(3G), glCopyTexImage2D(3G), glCopyTexSubImage1D(3G),
284 glCopyTexSubImage2D(3G), glCopyTexSubImage3D(3G), glDrawPixels(3G),
285 glNewList(3G), glPixelMap(3G), glPixelStore(3G), glPixelZoom(3G),
286 glReadPixels(3G), glTexImage1D(3G), glTexImage2D(3G), glTexImage3D(3G),
287 glTexSubImage1D(3G), glTexSubImage2D(3G), glTexSubImage3D(3G)
288
289
290
291 GLPIXELTRANSFER(3G)