glPushAttrib里的各个BIT都save了些什么

Description

glPushAttrib takes one argument, a mask that indicates which groups of state variables to save on the attribute stack. Symbolic constants are used to set bits in the mask. mask is typically constructed by ORing several of these constants together. The special mask GL_ALL_ATTRIB_BITS can be used to save all stackable states.

The symbolic mask constants and their associated GL state are as follows (the second column lists which attributes are saved):

GL_ACCUM_BUFFER_BITAccumulation buffer clear value
  
GL_COLOR_BUFFER_BITGL_ALPHA_TEST enable bit
 Alpha test function and reference value
 GL_BLEND enable bit
 Blending source and destination functions
 Constant blend color
 Blending equation
 GL_DITHER enable bit
 GL_DRAW_BUFFER setting
 GL_COLOR_LOGIC_OP enable bit
 GL_INDEX_LOGIC_OP enable bit
 Logic op function
 Color mode and index mode clear values
 Color mode and index mode writemasks
  
GL_CURRENT_BITCurrent RGBA color
 Current color index
 Current normal vector
 Current texture coordinates
 Current raster position
 GL_CURRENT_RASTER_POSITION_VALID flag
 RGBA color associated with current raster position
 Color index associated with current raster position
 Texture coordinates associated with current raster position
 GL_EDGE_FLAG flag
  
GL_DEPTH_BUFFER_BITGL_DEPTH_TEST enable bit
 Depth buffer test function
 Depth buffer clear value
 GL_DEPTH_WRITEMASK enable bit
  
GL_ENABLE_BITGL_ALPHA_TEST flag
 GL_AUTO_NORMAL flag
 GL_BLEND flag
 Enable bits for the user-definable clipping planes
 GL_COLOR_MATERIAL
 GL_CULL_FACE flag
 GL_DEPTH_TEST flag
 GL_DITHER flag
 GL_FOG flag
 GL_LIGHTi where 0<= i<GL_MAX_LIGHTS
 GL_LIGHTING flag
 GL_LINE_SMOOTH flag
 GL_LINE_STIPPLE flag
 GL_COLOR_LOGIC_OP flag
 GL_INDEX_LOGIC_OP flag
 GL_MAP1_x where x is a map type
 GL_MAP2_x where x is a map type
 GL_NORMALIZE flag
 GL_POINT_SMOOTH flag
 GL_POLYGON_OFFSET_LINE flag
 GL_POLYGON_OFFSET_FILL flag
 GL_POLYGON_OFFSET_POINT flag
 GL_POLYGON_SMOOTH flag
 GL_POLYGON_STIPPLE flag
 GL_SCISSOR_TEST flag
 GL_STENCIL_TEST flag
 GL_TEXTURE_1D flag
 GL_TEXTURE_2D flag
 GL_TEXTURE_3D flag
 Flags GL_TEXTURE_GEN_x where x is S, T, R, or Q
  
GL_EVAL_BITGL_MAP1_x enable bits, where x is a map type
 GL_MAP2_x enable bits, where x is a map type
 1D grid endpoints and divisions
 2D grid endpoints and divisions
 GL_AUTO_NORMAL enable bit
  
GL_FOG_BITGL_FOG enable bit
 Fog color
 Fog density
 Linear fog start
 Linear fog end
 Fog index
 GL_FOG_MODE value
  
GL_HINT_BITGL_PERSPECTIVE_CORRECTION_HINT setting
 GL_POINT_SMOOTH_HINT setting
 GL_LINE_SMOOTH_HINT setting
 GL_POLYGON_SMOOTH_HINT setting
 GL_FOG_HINT setting
  
GL_LIGHTING_BITGL_COLOR_MATERIAL enable bit
 GL_COLOR_MATERIAL_FACE value
 Color material parameters that are tracking the current color
 Ambient scene color
 GL_LIGHT_MODEL_LOCAL_VIEWER value
 GL_LIGHT_MODEL_TWO_SIDE setting
 GL_LIGHTING enable bit
 Enable bit for each light
 Ambient, diffuse, and specular intensity for each light
 Direction, position, exponent, and cutoff angle for each light
 Constant, linear, and quadratic attenuation factors for each light
 Ambient, diffuse, specular, and emissive color for each material
 Ambient, diffuse, and specular color indices for each material
 Specular exponent for each material
 GL_SHADE_MODEL setting
  
GL_LINE_BITGL_LINE_SMOOTH flag
 GL_LINE_STIPPLE enable bit
 Line stipple pattern and repeat counter
 Line width
  
GL_LIST_BITGL_LIST_BASE setting
  
GL_PIXEL_MODE_BITGL_RED_BIAS and GL_RED_SCALE settings
 GL_GREEN_BIAS and GL_GREEN_SCALE values
 GL_BLUE_BIAS and GL_BLUE_SCALE
 GL_ALPHA_BIAS and GL_ALPHA_SCALE
 GL_DEPTH_BIAS and GL_DEPTH_SCALE
 GL_INDEX_OFFSET and GL_INDEX_SHIFT values
 GL_MAP_COLOR and GL_MAP_STENCIL flags
 GL_ZOOM_X and GL_ZOOM_Y factors
 GL_READ_BUFFER setting
  
GL_POINT_BITGL_POINT_SMOOTH flag
 Point size
  
GL_POLYGON_BITGL_CULL_FACE enable bit
 GL_CULL_FACE_MODE value
 GL_FRONT_FACE indicator
 GL_POLYGON_MODE setting
 GL_POLYGON_SMOOTH flag
 GL_POLYGON_STIPPLE enable bit
 GL_POLYGON_OFFSET_FILL flag
 GL_POLYGON_OFFSET_LINE flag
 GL_POLYGON_OFFSET_POINT flag
 GL_POLYGON_OFFSET_FACTOR
 GL_POLYGON_OFFSET_UNITS
  
GL_POLYGON_STIPPLE_BITPolygon stipple image
  
GL_SCISSOR_BITGL_SCISSOR_TEST flag
 Scissor box
  
GL_STENCIL_BUFFER_BITGL_STENCIL_TEST enable bit
 Stencil function and reference value
 Stencil value mask
 Stencil fail, pass, and depth buffer pass actions
 Stencil buffer clear value
 Stencil buffer writemask
  
GL_TEXTURE_BITEnable bits for the four texture coordinates
 Border color for each texture image
 Minification function for each texture image
 Magnification function for each texture image
 Texture coordinates and wrap mode for each texture image
 Color and mode for each texture environment
 Enable bits GL_TEXTURE_GEN_xx is S, T, R, and Q
 GL_TEXTURE_GEN_MODE setting for S, T, R, and Q
 glTexGen plane equations for S, T, R, and Q
 Current texture bindings (for example, GL_TEXTURE_BINDING_2D)
  
GL_TRANSFORM_BITCoefficients of the six clipping planes
 Enable bits for the user-definable clipping planes
 GL_MATRIX_MODE value
 GL_NORMALIZE flag
 GL_RESCALE_NORMAL flag
  
GL_VIEWPORT_BITDepth range (near and far)
 Viewport origin and extent

glPopAttrib restores the values of the state variables saved with the last

glPushAttrib command. Those not saved are left unchanged.

It is an error to push attributes onto a full stack, or to pop attributes off an empty stack. In either case, the error flag is set and no other change is made to GL state.

Initially, the attribute stack is empty.

Notes

Not all values for GL state can be saved on the attribute stack. For example, render mode state, and select and feedback state cannot be saved. Client state must be saved with glPushClientAttrib.

The depth of the attribute stack depends on the implementation, but it must be at least 16.

When the GL_ARB_multitexture extension is supported, pushing and popping texture state apples to all supported texture units.

Errors

GL_STACK_OVERFLOW is generated if glPushAttrib is called while the attribute stack is full.

GL_STACK_UNDERFLOW is generated if glPopAttrib is called while the attribute stack is empty.

GL_INVALID_OPERATION is generated if glPushAttrib or glPopAttrib is executed between the execution of glBegin and the corresponding execution of glEnd.

Associated Gets

glGet with argument GL_ATTRIB_STACK_DEPTH

glGet with argument GL_MAX_ATTRIB_STACK_DEPTH

转载于:https://www.cnblogs.com/oiramario/archive/2010/04/13/1711114.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值