Name 函数名
glPixelMap — set up pixel transfer maps 设置像素转换映射
C Specification C风格描述
void glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values);
void glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values);
void glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values);
Parameters 参数
map
Specifies a symbolic map name.Must be one of the following:
指定一个符号映射名,必须是下面的值:
map |
GL_PIXEL_MAP_I_TO_I |
GL_PIXEL_MAP_S_TO_S |
GL_PIXEL_MAP_I_TO_R |
GL_PIXEL_MAP_I_TO_G |
GL_PIXEL_MAP_I_TO_B |
GL_PIXEL_MAP_I_TO_A |
GL_PIXEL_MAP_R_TO_R |
GL_PIXEL_MAP_G_TO_G |
GL_PIXEL_MAP_B_TO_B |
GL_PIXEL_MAP_A_TO_A |
mapsize
Specifies the size of the map being defined.指定将要映射的大小
values
Specifies an array of mapsize values.指定一个映射尺寸大小的值数组
Description 描述
glPixelMap sets up translation tables,or maps, used by glCopyPixels,glCopyTexImage1D,glCopyTexImage2D,glCopyTexSubImage1D,glCopyTexSubImage2D,glCopyTexSubImage3D,glDrawPixels,glReadPixels,glTexImage1D,glTexImage2D,glTexImage3D,glTexSubImage1D,glTexSubImage2D, and glTexSubImage3D.Additionally, if the ARB_imaging subset is supported, the routines glColorTable,glColorSubTable,glConvolutionFilter1D,glConvolutionFilter2D,glHistogram,glMinmax, and glSeparableFilter2D.Use of these maps is described completely in the glPixelTransfer reference page,and partly in the reference pages for the pixel and texture image commands.Only the specification of the maps is described in this reference page.
glPixelMap函数通过如下的函数进行转化表或者映射的设置:glCopyPixels,glCopyTexImage1D,glCopyTexImage2D,glCopyTexSubImage1D,glCopyTexSubImage2D,glCopyTexSubImage3D,glDrawPixels,glReadPixels,glTexImage1D,glTexImage2D,glTexImage3D,glTexSubImage1D,glTexSubImage2D,glTexSubImage3D。另外,如果支持ARB图像子集,例程glColorTable,glColorSubTable,glConvolutionFilter1D,glConvolutionFilter2D,glHistogram,glMinmax, 和 glSeparableFilter2D。(这句话怎么后半句少了点什么,谓语呢?这也不是个省略句之类的啊,坑我呢这是!这里到底发生了什么?)
map is a symbolic map name,indicating one of ten maps to set.mapsize specifies the number of entries in the map,and values is a pointer to an array of mapsize map values.
map表示一个符号映射名,表示会从下面的十种类型中选择一种来设置映射。mapsize表示映射项的数目,它的值是由一个具有该映射规模大小的数组所指定的值。
If a non-zero named buffer object is bound to the GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer) while a pixel transfer map is specified, values is treated as a byte offset into the buffer object's data store.
如果一个非零命名的缓冲区对象绑定到了GL_PIXEL_UNPACK_BUFFER上,当指定了像素转化映射时,值就会在缓冲区对象的数据存储中被当作字节偏移。
The ten maps are as follows: 十种映射如下所示:
GL_PIXEL_MAP_I_TO_I
Maps color indices to color indices.
映射颜色索引到颜色索引。
GL_PIXEL_MAP_S_TO_S
Maps stencil indices to stencil indices.
映射模板索引到模板索引。
GL_PIXEL_MAP_I_TO_R
Maps color indices to red components.
映射颜色索引到红色成分。
GL_PIXEL_MAP_I_TO_G
Maps color indices to green components.
映射颜色索引的绿色成分。
GL_PIXEL_MAP_I_TO_B
Maps color indices to blue components.
映射颜色索引到蓝色成分。
GL_PIXEL_MAP_I_TO_A
Maps color indices to alpha components.
映射颜色索引到alpha成分。
GL_PIXEL_MAP_R_TO_R
Maps red components to red components.
映射红色成分到红色成分。
GL_PIXEL_MAP_G_TO_G
Maps green components to green components.
映射绿色成分到绿色成分。
GL_PIXEL_MAP_B_TO_B
Maps blue components to blue components. 映射蓝色成分到蓝色成分。
GL_PIXEL_MAP_A_TO_A
Maps alpha components to alpha components.
映射alpha成分到alpha成分。
The entries in a map can be specified as single-precision floating-point numbers,unsigned short integers,or unsigned int integers.Maps that store color component values(all but GL_PIXEL_MAP_I_TO_I and GL_PIXEL_MAP_S_TO_S) retain their values in floating-point format,with unspecified mantissa and exponent sizes.Floating-point values specified by glPixelMapfv are converted directly to the internal floating-point format of these maps,then clamped to the range [0,1].Unsigned integer values specified by glPixelMapusv and glPixelMapuiv are converted linearly such that the largest representable integer maps to 1.0,and 0 maps to 0.0.
映射中的项可以被指定为单精度浮点数、无符号短整型、或者无符号整数。映射存储颜色成分的值(GL_PIXEL_MAP_I_TO_I 和 GL_PIXEL_MAP_S_TO_S除外),将以浮点数形式保存它们的值,但未指定尾数和指数规模。通过glPixelMapfv指定的浮点值将被直接转换为这些映射的内部浮点型格式,然后限定在[0,1]的范围内。通过glPixelMapusv 和glPixelMapuiv指定的无符号整型值会被线性的转换,例如最大整数转化为1.0,0被转化为0.0。
Maps that store indices,GL_PIXEL_MAP_I_TO_I and GL_PIXEL_MAP_S_TO_S,retain their values in fixed-point format,with an unspecified number of bits to the right of the binary point.Floating-point values specified by glPixelMapfv are converted directly to the internal fixed-point format of these maps.Unsigned integer values specified by glPixelMapusv and glPixelMapuiv specify integer values,with all 0's to the right of the binary point.存储索引、GL_PIXEL_MAP_I_TO_I 和 GL_PIXEL_MAP_S_TO_S的映射以定点数的形式保存值,并且未指定二进制小数点右边的比特位上的数值。通过glPixelMapfv指定的浮点值会被直接转换为这些映射的内部格式的定点数。通过glPixelMapusv和glPixelMapuiv函数指定无符号整数值时,二进制小数点右边全部设为0。
The following table shows the initial sizes and values for each of the maps.Maps that are indexed by either color or stencil indices must have mapsize = 2^n for some n
or the results are undefined.The maximum allowable size for each map depends on the implementation and can be determined by calling glGet with argument GL_MAX_PIXEL_MAP_TABLE.The single maximum applies to all maps; it is at least 32.
下面的表格展示了每种映射的初始大小和初始值。每种由颜色或模板索引的映射必须符合mapsize = 2^n,因为有时n或者mapsize是未定义的。每种映射的最大可分配大小都是基于实现的,并且可以通过调用
使用GL_MAX_PIXEL_MAP_TABLE的glGet函数来更改。单一的最大值应用到所有的映射。(这句话怎么翻译?)最小为32。
map |
Lookup Index |
Lookup Value |
Initial Size |
Initial Value |
GL_PIXEL_MAP_I_TO_I |
color index |
color index |
1 |
0 |
GL_PIXEL_MAP_S_TO_S |
stencil index |
stencil index |
1 |
0 |
GL_PIXEL_MAP_I_TO_R |
color index |
R |
1 |
0 |
GL_PIXEL_MAP_I_TO_G |
color index |
G |
1 |
0 |
GL_PIXEL_MAP_I_TO_B |
color index |
B |
1 |
0 |
GL_PIXEL_MAP_I_TO_A |
color index |
A |
1 |
0 |
GL_PIXEL_MAP_R_TO_R |
R |
R |
1 |
0 |
GL_PIXEL_MAP_G_TO_G |
G |
G |
1 |
0 |
GL_PIXEL_MAP_B_TO_B |
B |
B |
1 |
0 |
GL_PIXEL_MAP_A_TO_A |
A |
A |
1 |
0 |
Errors
GL_INVALID_ENUM is generated if map is not an accepted value.
GL_INVALID_VALUE is generated if mapsize is less than one or larger than GL_MAX_PIXEL_MAP_TABLE.
GL_INVALID_VALUE is generated if map isGL_PIXEL_MAP_I_TO_I,GL_PIXEL_MAP_S_TO_S,GL_PIXEL_MAP_I_TO_R,GL_PIXEL_MAP_I_TO_G,GL_PIXEL_MAP_I_TO_B, orGL_PIXEL_MAP_I_TO_A,and mapsize is not a power of two.
GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the
GL_PIXEL_UNPACK_BUFFER target and the buffer object's data store is currently mapped.
GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the
GL_PIXEL_UNPACK_BUFFER target and the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.
GL_INVALID_OPERATION is generated by glPixelMapfv if a non-zero buffer object name is bound to the
GL_PIXEL_UNPACK_BUFFER target and values is not evenly divisible into the number of bytes needed to store in memory a GLfloat datum.
GL_INVALID_OPERATION is generated by glPixelMapuiv if a non-zero buffer object name is bound to the
GL_PIXEL_UNPACK_BUFFER target and values is not evenly divisible into the number of bytes needed to store in memory a GLuint datum.
GL_INVALID_OPERATION is generated by glPixelMapusv if a non-zero buffer object name is bound to the
GL_PIXEL_UNPACK_BUFFER target and values is not evenly divisible into the number of bytes needed to store in memory a GLushort datum.
GL_INVALID_OPERATION is generated if glPixelMap is executed between the execution of glBegin and the corresponding execution of glEnd.
Associated Gets
glGetPixelMap
glGet with argument GL_PIXEL_MAP_I_TO_I_SIZE
glGet with argument GL_PIXEL_MAP_S_TO_S_SIZE
glGet with argument GL_PIXEL_MAP_I_TO_R_SIZE
glGet with argument GL_PIXEL_MAP_I_TO_G_SIZE
glGet with argument GL_PIXEL_MAP_I_TO_B_SIZE
glGet with argument GL_PIXEL_MAP_I_TO_A_SIZE
glGet with argument GL_PIXEL_MAP_R_TO_R_SIZE
glGet with argument GL_PIXEL_MAP_G_TO_G_SIZE
glGet with argument GL_PIXEL_MAP_B_TO_B_SIZE
glGet with argument GL_PIXEL_MAP_A_TO_A_SIZE
glGet with argument GL_MAX_PIXEL_MAP_TABLE
glGet with argument GL_PIXEL_UNPACK_BUFFER_BINDING
See Also
glColorTable,
glColorSubTable,
glConvolutionFilter1D,
glConvolutionFilter2D,
glCopyPixels,
glCopyTexImage1D,
glCopyTexImage2D,
glCopyTexSubImage1D,
glCopyTexSubImage2D,
glDrawPixels,
glHistogram,
glMinmax,
glPixelStore,
glPixelTransfer,
glReadPixels,
glSeparableFilter2D,
glTexImage1D,
glTexImage2D,
glTexImage3D,
glTexSubImage1D,
glTexSubImage2D,
glTexSubImage3D
Copyright
Copyright © 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
http://oss.sgi.com/projects/FreeB/.