Name

glEnable — enable or disable server-side GL capabilities

C Specification

void glEnable(GLenum cap);
 
void glDisable(GLenum cap);
 

Parameters

cap

Specifies a symbolic constant indicating a GL capability.

Description

glEnable and glDisable enable and disable various capabilities. Use glIsEnabled or glGet to determine the current setting of any capability. The initial value for each capability with the exception of GL_DITHER and GL_MULTISAMPLE is GL_FALSE. The initial value for GL_DITHER and GL_MULTISAMPLE is GL_TRUE.

Both glEnable and glDisable take a single argument, cap, which can assume one of the following values:

GL_ALPHA_TEST

If enabled, do alpha testing. See glAlphaFunc.

GL_BLEND

If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc.

GL_COLOR_LOGIC_OP

If enabled, apply the currently selected logical operation to the computed fragment color and color buffer values. See glLogicOp.

GL_CLIP_PLANEi

If enabled, clip geometry against user-defined clipping plane i. See glClipPlane.

GL_COLOR_MATERIAL

If enabled, have ambient and diffuse material parameters track the current color.

GL_CULL_FACE

If enabled, cull polygons based on their winding in window coordinates. See glCullFace.

GL_DEPTH_TEST

If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRange.

GL_DITHER

If enabled, dither color components before they are written to the color buffer.

GL_FOG

If enabled, blend a fog color into the posttexturing color. See glFog.

GL_LIGHTi

If enabled, include light i in the evaluation of the lighting equation. See glLightModel and glLight.

GL_LIGHTING

If enabled, use the current lighting parameters to compute the vertex color. Otherwise, simply associate the current color with each vertex. See glMaterial, glLightModel, and glLight.

GL_LINE_SMOOTH

If enabled, draw lines with correct filtering. Otherwise, draw aliased lines. See glLineWidth.

GL_MULTISAMPLE

If enabled, use multiple fragment samples in computing the final color of a pixel. See glSampleCoverage.

GL_NORMALIZE

If enabled, normal vectors are normalized to unit length after transformation and before lighting. This method is generally less efficient than GL_RESCALE_NORMAL. See glNormal and glNormalPointer.

GL_POINT_SMOOTH

If enabled, draw points with proper filtering. Otherwise, draw aliased points. See glPointSize.

GL_POINT_SPRITE_OES

If enabled, point sprites are enabled. See glPointSize and glTexEnv

GL_POLYGON_OFFSET_FILL

If enabled, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset.

GL_RESCALE_NORMAL

If enabled, normal vectors are scaled after transformation and before lighting by a factor computed from the modelview matrix. If the modelview matrix scales space uniformly, this has the effect of restoring the transformed normal to unit length. This method is generally more efficient than GL_NORMALIZE. See glNormal and glNormalPointer.

GL_SAMPLE_ALPHA_TO_COVERAGE

If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value.

GL_SAMPLE_ALPHA_TO_ONE

If enabled, each sample alpha value is replaced by the maximum representable alpha value.

GL_SAMPLE_COVERAGE

If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage.

GL_SCISSOR_TEST

If enabled, discard fragments that are outside the scissor rectangle. See glScissor.

GL_STENCIL_TEST

If enabled, do stencil testing and update the stencil buffer. See glStencilFunc, glStencilMask, and glStencilOp.

GL_TEXTURE_2D

If enabled, two-dimensional texturing is performed for the active texture unit. See glActiveTexture, glTexImage2D, glCompressedTexImage2D, and glCopyTexImage2D.

Notes

GL_CLIP_PLANEi and GL_POINT_SPRITE_OES are only supported if the GL version is 1.1 or greater.

Errors

GL_INVALID_ENUM is generated if cap is not one of the values listed previously.

Associated Gets

glIsEnabled

glGet

See Also

glActiveTexture, glAlphaFunc, glBlendFunc, glClipPlane, glCompressedTexImage2D, glCopyTexImage2D, glCullFace, glDepthFunc, glDepthRange, glEnableClientState, glFog, glGet, glIsEnabled, glLight, glLightModel, glLineWidth, glLogicOp, glMaterial, glNormal, glPointSize, glPolygonOffset, glSampleCoverage, glScissor, glStencilFunc, glStencilOp, glTexEnv, glTexImage2D

Copyright

Copyright © 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.