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

NAME

6       glPixelTransfer - set pixel transfer modes
7

C SPECIFICATION

9       void glPixelTransferf(GLenum pname, GLfloat param);
10
11       void glPixelTransferi(GLenum pname, GLint param);
12

PARAMETERS

14       pname
15           Specifies the symbolic name of the pixel transfer parameter to be
16           set. Must be one of the following: GL_MAP_COLOR, GL_MAP_STENCIL,
17           GL_INDEX_SHIFT, GL_INDEX_OFFSET, GL_RED_SCALE, GL_RED_BIAS,
18           GL_GREEN_SCALE, GL_GREEN_BIAS, GL_BLUE_SCALE, GL_BLUE_BIAS,
19           GL_ALPHA_SCALE, GL_ALPHA_BIAS, GL_DEPTH_SCALE, or GL_DEPTH_BIAS.
20
21           Additionally, if the ARB_imaging extension is supported, the
22           following symbolic names are accepted:
23           GL_POST_COLOR_MATRIX_RED_SCALE, GL_POST_COLOR_MATRIX_GREEN_SCALE,
24           GL_POST_COLOR_MATRIX_BLUE_SCALE, GL_POST_COLOR_MATRIX_ALPHA_SCALE,
25           GL_POST_COLOR_MATRIX_RED_BIAS, GL_POST_COLOR_MATRIX_GREEN_BIAS,
26           GL_POST_COLOR_MATRIX_BLUE_BIAS, GL_POST_COLOR_MATRIX_ALPHA_BIAS,
27           GL_POST_CONVOLUTION_RED_SCALE, GL_POST_CONVOLUTION_GREEN_SCALE,
28           GL_POST_CONVOLUTION_BLUE_SCALE, GL_POST_CONVOLUTION_ALPHA_SCALE,
29           GL_POST_CONVOLUTION_RED_BIAS, GL_POST_CONVOLUTION_GREEN_BIAS,
30           GL_POST_CONVOLUTION_BLUE_BIAS, and GL_POST_CONVOLUTION_ALPHA_BIAS.
31
32       param
33           Specifies the value that pname is set to.
34

DESCRIPTION

36       glPixelTransfer sets pixel transfer modes that affect the operation of
37       subsequent glCopyPixels(), glCopyTexImage1D(), glCopyTexImage2D(),
38       glCopyTexSubImage1D(), glCopyTexSubImage2D(), glCopyTexSubImage3D(),
39       glDrawPixels(), glReadPixels(), glTexImage1D(), glTexImage2D(),
40       glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(), and
41       glTexSubImage3D() commands. Additionally, if the ARB_imaging subset is
42       supported, the routines glColorTable(), glColorSubTable(),
43       glConvolutionFilter1D(), glConvolutionFilter2D(), glHistogram(),
44       glMinmax(), and glSeparableFilter2D() are also affected. The algorithms
45       that are specified by pixel transfer modes operate on pixels after they
46       are read from the frame buffer (glCopyPixels()glCopyTexImage1D(),
47       glCopyTexImage2D(), glCopyTexSubImage1D(), glCopyTexSubImage2D(),
48       glCopyTexSubImage3D(), and glReadPixels()), or unpacked from client
49       memory (glDrawPixels(), glTexImage1D(), glTexImage2D(), glTexImage3D(),
50       glTexSubImage1D(), glTexSubImage2D(), and glTexSubImage3D()). Pixel
51       transfer operations happen in the same order, and in the same manner,
52       regardless of the command that resulted in the pixel operation. Pixel
53       storage modes (see glPixelStore()) control the unpacking of pixels
54       being read from client memory and the packing of pixels being written
55       back into client memory.
56
57       Pixel transfer operations handle four fundamental pixel types: color,
58       color index, depth, and stencil.  Color pixels consist of four
59       floating-point values with unspecified mantissa and exponent sizes,
60       scaled such that 0 represents zero intensity and 1 represents full
61       intensity.  Color indices comprise a single fixed-point value, with
62       unspecified precision to the right of the binary point.  Depth pixels
63       comprise a single floating-point value, with unspecified mantissa and
64       exponent sizes, scaled such that 0.0 represents the minimum depth
65       buffer value, and 1.0 represents the maximum depth buffer value.
66       Finally, stencil pixels comprise a single fixed-point value, with
67       unspecified precision to the right of the binary point.
68
69       The pixel transfer operations performed on the four basic pixel types
70       are as follows:
71
72       Color
73           Each of the four color components is multiplied by a scale factor,
74           then added to a bias factor. That is, the red component is
75           multiplied by GL_RED_SCALE, then added to GL_RED_BIAS; the green
76           component is multiplied by GL_GREEN_SCALE, then added to
77           GL_GREEN_BIAS; the blue component is multiplied by GL_BLUE_SCALE,
78           then added to GL_BLUE_BIAS; and the alpha component is multiplied
79           by GL_ALPHA_SCALE, then added to GL_ALPHA_BIAS. After all four
80           color components are scaled and biased, each is clamped to the
81           range 0 1. All color, scale, and bias values are specified with
82           glPixelTransfer.
83
84           If GL_MAP_COLOR is true, each color component is scaled by the size
85           of the corresponding color-to-color map, then replaced by the
86           contents of that map indexed by the scaled component. That is, the
87           red component is scaled by GL_PIXEL_MAP_R_TO_R_SIZE, then replaced
88           by the contents of GL_PIXEL_MAP_R_TO_R indexed by itself. The green
89           component is scaled by GL_PIXEL_MAP_G_TO_G_SIZE, then replaced by
90           the contents of GL_PIXEL_MAP_G_TO_G indexed by itself. The blue
91           component is scaled by GL_PIXEL_MAP_B_TO_B_SIZE, then replaced by
92           the contents of GL_PIXEL_MAP_B_TO_B indexed by itself. And the
93           alpha component is scaled by GL_PIXEL_MAP_A_TO_A_SIZE, then
94           replaced by the contents of GL_PIXEL_MAP_A_TO_A indexed by itself.
95           All components taken from the maps are then clamped to the range 0
96           1.  GL_MAP_COLOR is specified with glPixelTransfer. The contents of
97           the various maps are specified with glPixelMap().
98
99           If the ARB_imaging extension is supported, each of the four color
100           components may be scaled and biased after transformation by the
101           color matrix. That is, the red component is multiplied by
102           GL_POST_COLOR_MATRIX_RED_SCALE, then added to
103           GL_POST_COLOR_MATRIX_RED_BIAS; the green component is multiplied by
104           GL_POST_COLOR_MATRIX_GREEN_SCALE, then added to
105           GL_POST_COLOR_MATRIX_GREEN_BIAS; the blue component is multiplied
106           by GL_POST_COLOR_MATRIX_BLUE_SCALE, then added to
107           GL_POST_COLOR_MATRIX_BLUE_BIAS; and the alpha component is
108           multiplied by GL_POST_COLOR_MATRIX_ALPHA_SCALE, then added to
109           GL_POST_COLOR_MATRIX_ALPHA_BIAS. After all four color components
110           are scaled and biased, each is clamped to the range 0 1.
111
112           Similarly, if the ARB_imaging extension is supported, each of the
113           four color components may be scaled and biased after processing by
114           the enabled convolution filter. That is, the red component is
115           multiplied by GL_POST_CONVOLUTION_RED_SCALE, then added to
116           GL_POST_CONVOLUTION_RED_BIAS; the green component is multiplied by
117           GL_POST_CONVOLUTION_GREEN_SCALE, then added to
118           GL_POST_CONVOLUTION_GREEN_BIAS; the blue component is multiplied by
119           GL_POST_CONVOLUTION_BLUE_SCALE, then added to
120           GL_POST_CONVOLUTION_BLUE_BIAS; and the alpha component is
121           multiplied by GL_POST_CONVOLUTION_ALPHA_SCALE, then added to
122           GL_POST_CONVOLUTION_ALPHA_BIAS. After all four color components are
123           scaled and biased, each is clamped to the range 0 1.
124
125       Color index
126           Each color index is shifted left by GL_INDEX_SHIFT bits; any bits
127           beyond the number of fraction bits carried by the fixed-point index
128           are filled with zeros. If GL_INDEX_SHIFT is negative, the shift is
129           to the right, again zero filled. Then GL_INDEX_OFFSET is added to
130           the index.  GL_INDEX_SHIFT and GL_INDEX_OFFSET are specified with
131           glPixelTransfer.
132
133           From this point, operation diverges depending on the required
134           format of the resulting pixels. If the resulting pixels are to be
135           written to a color index buffer, or if they are being read back to
136           client memory in GL_COLOR_INDEX format, the pixels continue to be
137           treated as indices. If GL_MAP_COLOR is true, each index is masked
138           by 2 n - 1, where n is GL_PIXEL_MAP_I_TO_I_SIZE, then replaced by
139           the contents of GL_PIXEL_MAP_I_TO_I indexed by the masked value.
140           GL_MAP_COLOR is specified with glPixelTransfer. The contents of the
141           index map is specified with glPixelMap().
142
143           If the resulting pixels are to be written to an RGBA color buffer,
144           or if they are read back to client memory in a format other than
145           GL_COLOR_INDEX, the pixels are converted from indices to colors by
146           referencing the four maps GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_G,
147           GL_PIXEL_MAP_I_TO_B, and GL_PIXEL_MAP_I_TO_A. Before being
148           dereferenced, the index is masked by 2 n - 1, where n is
149           GL_PIXEL_MAP_I_TO_R_SIZE for the red map, GL_PIXEL_MAP_I_TO_G_SIZE
150           for the green map, GL_PIXEL_MAP_I_TO_B_SIZE for the blue map, and
151           GL_PIXEL_MAP_I_TO_A_SIZE for the alpha map. All components taken
152           from the maps are then clamped to the range 0 1. The contents of
153           the four maps is specified with glPixelMap().
154
155       Depth
156           Each depth value is multiplied by GL_DEPTH_SCALE, added to
157           GL_DEPTH_BIAS, then clamped to the range 0 1.
158
159       Stencil
160           Each index is shifted GL_INDEX_SHIFT bits just as a color index is,
161           then added to GL_INDEX_OFFSET. If GL_MAP_STENCIL is true, each
162           index is masked by 2 n - 1, where n is GL_PIXEL_MAP_S_TO_S_SIZE,
163           then replaced by the contents of GL_PIXEL_MAP_S_TO_S indexed by the
164           masked value.
165
166       The following table gives the type, initial value, and range of valid
167       values for each of the pixel transfer parameters that are set with
168       glPixelTransfer.
169
170       ┌─────────────────────────────────┬──────────────────────────────┬─────────────────────────────────┬───────────────────────────────┐
171       │                                 │                              │                                 │                               │
172pnameType Initial Valid 
173       │                                 │                              │ Value                           Range                         
174       │                                 │                              │                                 │                               │
175       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
176GL_MAP_COLOR                     │           boolean            │              false              │          true/false           │
177       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
178GL_MAP_STENCIL                   │           boolean            │              false              │          true/false           │
179       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
180GL_INDEX_SHIFT                   │           integer            │                0                │               -               │
181       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
182GL_INDEX_OFFSET                  │           integer            │                0                │               -               │
183       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
184GL_RED_SCALE                     │            float             │                1                │               -               │
185       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
186GL_GREEN_SCALE                   │            float             │                1                │               -               │
187       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
188GL_BLUE_SCALE                    │            float             │                1                │               -               │
189       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
190GL_ALPHA_SCALE                   │            float             │                1                │               -               │
191       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
192GL_DEPTH_SCALE                   │            float             │                1                │               -               │
193       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
194GL_RED_BIAS                      │            float             │                0                │               -               │
195       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
196GL_GREEN_BIAS                    │            float             │                0                │               -               │
197       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
198GL_BLUE_BIAS                     │            float             │                0                │               -               │
199       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
200GL_ALPHA_BIAS                    │            float             │                0                │               -               │
201       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
202GL_DEPTH_BIAS                    │            float             │                0                │               -               │
203       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
204GL_POST_COLOR_MATRIX_RED_SCALE   │            float             │                1                │               -               │
205       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
206GL_POST_COLOR_MATRIX_GREEN_SCALE │            float             │                1                │               -               │
207       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
208GL_POST_COLOR_MATRIX_BLUE_SCALE  │            float             │                1                │               -               │
209       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
210GL_POST_COLOR_MATRIX_ALPHA_SCALE │            float             │                1                │               -               │
211       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
212GL_POST_COLOR_MATRIX_RED_BIAS    │            float             │                0                │               -               │
213       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
214GL_POST_COLOR_MATRIX_GREEN_BIAS  │            float             │                0                │               -               │
215       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
216GL_POST_COLOR_MATRIX_BLUE_BIAS   │            float             │                0                │               -               │
217       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
218GL_POST_COLOR_MATRIX_ALPHA_BIAS  │            float             │                0                │               -               │
219       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
220GL_POST_CONVOLUTION_RED_SCALE    │            float             │                1                │               -               │
221       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
222GL_POST_CONVOLUTION_GREEN_SCALE  │            float             │                1                │               -               │
223       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
224GL_POST_CONVOLUTION_BLUE_SCALE   │            float             │                1                │               -               │
225       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
226GL_POST_CONVOLUTION_ALPHA_SCALE  │            float             │                1                │               -               │
227       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
228GL_POST_CONVOLUTION_RED_BIAS     │            float             │                0                │               -               │
229       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
230GL_POST_CONVOLUTION_GREEN_BIAS   │            float             │                0                │               -               │
231       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
232GL_POST_CONVOLUTION_BLUE_BIAS    │            float             │                0                │               -               │
233       ├─────────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼───────────────────────────────┤
234GL_POST_CONVOLUTION_ALPHA_BIAS   │            float             │                0                │               -               │
235       └─────────────────────────────────┴──────────────────────────────┴─────────────────────────────────┴───────────────────────────────┘
236
237       glPixelTransferf can be used to set any pixel transfer parameter. If
238       the parameter type is boolean, 0 implies false and any other value
239       implies true. If pname is an integer parameter, param is rounded to the
240       nearest integer.
241
242       Likewise, glPixelTransferi can be used to set any of the pixel transfer
243       parameters. Boolean parameters are set to false if param is 0 and to
244       true otherwise.  param is converted to floating point before being
245       assigned to real-valued parameters.
246

NOTES

248       If a glColorTable(), glColorSubTable(), glConvolutionFilter1D(),
249       glConvolutionFilter2D(), glCopyPixels(), glCopyTexImage1D(),
250       glCopyTexImage2D(), glCopyTexSubImage1D(), glCopyTexSubImage2D(),
251       glCopyTexSubImage3D(), glDrawPixels(), glReadPixels(),
252       glSeparableFilter2D(), glTexImage1D(), glTexImage2D(), glTexImage3D(),
253       glTexSubImage1D(), glTexSubImage2D(), or glTexSubImage3D() command is
254       placed in a display list (see glNewList() and glCallList()), the pixel
255       transfer mode settings in effect when the display list is executed are
256       the ones that are used. They may be different from the settings when
257       the command was compiled into the display list.
258

ERRORS

260       GL_INVALID_ENUM is generated if pname is not an accepted value.
261
262       GL_INVALID_OPERATION is generated if glPixelTransfer is executed
263       between the execution of glBegin() and the corresponding execution of
264       glEnd().
265

ASSOCIATED GETS

267       glGet() with argument GL_MAP_COLOR
268
269       glGet() with argument GL_MAP_STENCIL
270
271       glGet() with argument GL_INDEX_SHIFT
272
273       glGet() with argument GL_INDEX_OFFSET
274
275       glGet() with argument GL_RED_SCALE
276
277       glGet() with argument GL_RED_BIAS
278
279       glGet() with argument GL_GREEN_SCALE
280
281       glGet() with argument GL_GREEN_BIAS
282
283       glGet() with argument GL_BLUE_SCALE
284
285       glGet() with argument GL_BLUE_BIAS
286
287       glGet() with argument GL_ALPHA_SCALE
288
289       glGet() with argument GL_ALPHA_BIAS
290
291       glGet() with argument GL_DEPTH_SCALE
292
293       glGet() with argument GL_DEPTH_BIAS
294
295       glGet() with argument GL_POST_COLOR_MATRIX_RED_SCALE
296
297       glGet() with argument GL_POST_COLOR_MATRIX_RED_BIAS
298
299       glGet() with argument GL_POST_COLOR_MATRIX_GREEN_SCALE
300
301       glGet() with argument GL_POST_COLOR_MATRIX_GREEN_BIAS
302
303       glGet() with argument GL_POST_COLOR_MATRIX_BLUE_SCALE
304
305       glGet() with argument GL_POST_COLOR_MATRIX_BLUE_BIAS
306
307       glGet() with argument GL_POST_COLOR_MATRIX_ALPHA_SCALE
308
309       glGet() with argument GL_POST_COLOR_MATRIX_ALPHA_BIAS
310
311       glGet() with argument GL_POST_CONVOLUTION_RED_SCALE
312
313       glGet() with argument GL_POST_CONVOLUTION_RED_BIAS
314
315       glGet() with argument GL_POST_CONVOLUTION_GREEN_SCALE
316
317       glGet() with argument GL_POST_CONVOLUTION_GREEN_BIAS
318
319       glGet() with argument GL_POST_CONVOLUTION_BLUE_SCALE
320
321       glGet() with argument GL_POST_CONVOLUTION_BLUE_BIAS
322
323       glGet() with argument GL_POST_CONVOLUTION_ALPHA_SCALE
324
325       glGet() with argument GL_POST_CONVOLUTION_ALPHA_BIAS
326

SEE ALSO

328       glCallList(), glColorTable(), glColorSubTable(),
329       glConvolutionFilter1D(), glConvolutionFilter2D(), glCopyPixels(),
330       glCopyTexImage1D(), glCopyTexImage2D(), glCopyTexSubImage1D(),
331       glCopyTexSubImage2D(), glCopyTexSubImage3D(), glDrawPixels(),
332       glNewList(), glPixelMap(), glPixelStore(), glPixelZoom(),
333       glReadPixels(), glTexImage1D(), glTexImage2D(), glTexImage3D(),
334       glTexSubImage1D(), glTexSubImage2D(), glTexSubImage3D()
335
337       Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
338       under the SGI Free Software B License. For details, see
339       http://oss.sgi.com/projects/FreeB/.
340

AUTHORS

342       opengl.org
343
344
345
346opengl.org                        06/10/2014               GLPIXELTRANSFER(3G)
Impressum