Context & stateGL 1.0

glDisable

Switches off a feature previously turned on with glEnable.

Signature

void glDisable(GLenum cap);

How it works

The counterpart of glEnable. Common pattern: disable a feature for one special pass and enable it again afterwards — for example, disabling depth testing to draw a full-screen post-processing quad.

Parameters

capGLenum

The capability to disable (same values as glEnable).

Common values

GL_DEPTH_TEST
Hide fragments behind closer ones using the depth buffer.
GL_BLEND
Mix fragment colors with what is already in the framebuffer (transparency).
GL_CULL_FACE
Skip triangles facing away from the camera.
GL_STENCIL_TEST
Accept or reject fragments using the stencil buffer.
GL_SCISSOR_TEST
Only draw inside the rectangle set by glScissor.
GL_POLYGON_OFFSET_FILL
Apply the depth offset from glPolygonOffset.
GL_FRAMEBUFFER_SRGB
Convert linear colors to sRGB when writing to an sRGB framebuffer.
GL_MULTISAMPLE
Use MSAA when the framebuffer has multiple samples (on by default).
GL_DEBUG_OUTPUT / GL_DEBUG_OUTPUT_SYNCHRONOUS
Send driver messages to the debug callback (synchronously = on the calling thread, right away).
GL_PROGRAM_POINT_SIZE
Let the vertex shader set gl_PointSize.

Errors

When the call is invalid it does nothing and sets an error, which glGetError returns:

GL_INVALID_ENUM
cap is not a known capability.

Example

example.cpp
1glDisable(GL_DEPTH_TEST);   // screen quad must not be depth-tested
2drawScreenQuad();
3glEnable(GL_DEPTH_TEST);
Official Khronos documentation