<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="glEnable">
    <refentryinfo>
        <copyright>
            <year>1991-2006</year>
            <holder>Silicon Graphics, Inc.</holder>
        </copyright>
        <copyright>
            <year>2011-2013</year>
            <holder>Khronos Group</holder>
        </copyright>
    </refentryinfo>
    <refmeta>
        <refentrytitle>glEnable</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glEnable</refname>
        <refpurpose>enable or disable server-side GL capabilities</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glEnable</function></funcdef>
                <paramdef>GLenum <parameter>cap</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glDisable</function></funcdef>
                <paramdef>GLenum <parameter>cap</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glEnablei</function></funcdef>
                <paramdef>GLenum <parameter>cap</parameter></paramdef>
                <paramdef>GLuint <parameter>index</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glDisablei</function></funcdef>
                <paramdef>GLenum <parameter>cap</parameter></paramdef>
                <paramdef>GLuint <parameter>index</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>cap</parameter></term>
            <listitem>
                <para>
                    Specifies a symbolic constant indicating a GL capability.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>index</parameter></term>
            <listitem>
                <para>
                    Specifies the index of the switch to disable (for
                    <function>glEnablei</function> and
                    <function>glDisablei</function> only).
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glEnable</function> and <function>glDisable</function>
            enable and disable various capabilities. Use
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry>
            or
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>
            to determine the current setting of any capability. The initial
            value for each capability with the exception of
            <constant>GL_DITHER</constant> and
            <constant>GL_MULTISAMPLE</constant> is
            <constant>GL_FALSE</constant>. The initial value for
            <constant>GL_DITHER</constant> and
            <constant>GL_MULTISAMPLE</constant> is
            <constant>GL_TRUE</constant>.
        </para>
        <para>
            Both <function>glEnable</function> and <function>glDisable</function> take a single argument, <parameter>cap</parameter>,
            which can assume one of the following values:
        </para>
        <para>
            Some of the GL's capabilities are indexed. <function>glEnablei</function> and <function>glDisablei</function> enable and disable
            indexed capabilities.
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GL_BLEND</constant></term>
                <listitem>
                 <para>
                </para>
                    <para>
                        If enabled,
                        blend the computed fragment color values with the values in the color
                        buffers. See <citerefentry><refentrytitle>glBlendFunc</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_CLIP_DISTANCE</constant><emphasis>i</emphasis></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, clip geometry against user-defined half space <emphasis>i</emphasis>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_COLOR_LOGIC_OP</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        apply the currently selected logical operation to the computed fragment
                        color and color buffer values. See <citerefentry><refentrytitle>glLogicOp</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_CULL_FACE</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        cull polygons based on their winding in window coordinates.
                        See <citerefentry><refentrytitle>glCullFace</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_DEBUG_OUTPUT</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, debug messages are produced by a debug context. When disabled,
                        the debug message log is silenced. Note that in a non-debug context, very
                        few, if any messages might be produced, even when <constant>GL_DEBUG_OUTPUT</constant>
                        is enabled.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_DEBUG_OUTPUT_SYNCHRONOUS</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, debug messages are produced synchronously by a debug context. If disabled,
                        debug messages may be produced asynchronously. In particular, they may be delayed relative
                        to the execution of GL commands, and the debug callback function may be called from
                        a thread other than that in which the commands are executed.
                        See <citerefentry><refentrytitle>glDebugMessageCallback</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_DEPTH_CLAMP</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        the
                        <!-- - wc <= zc <= wc -->
                        <inlineequation><mml:math>
                            <mml:mo>-</mml:mo><mml:msub><mml:mi>w</mml:mi><mml:mi>c</mml:mi></mml:msub><mml:mo>&le;</mml:mo><mml:msub><mml:mi>z</mml:mi><mml:mi>c</mml:mi></mml:msub><mml:mo>&le;</mml:mo><mml:msub><mml:mi>w</mml:mi><mml:mi>c</mml:mi></mml:msub>
                        </mml:math></inlineequation>
                        plane equation is ignored by view volume clipping (effectively, there is no near or
                        far plane clipping).
                        See <citerefentry><refentrytitle>glDepthRange</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_DEPTH_TEST</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        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
                        <citerefentry><refentrytitle>glDepthFunc</refentrytitle></citerefentry> and
                        <citerefentry><refentrytitle>glDepthRange</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_DITHER</constant>    </term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        dither color components or indices before they are written to the
                        color buffer.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_FRAMEBUFFER_SRGB</constant>    </term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled
                        and the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</constant> for the
                        framebuffer attachment corresponding to the destination buffer is <constant>GL_SRGB</constant>,
                        the R, G, and B destination color values (after conversion from fixed-point to floating-point)
                        are considered to be encoded for the sRGB color space and hence are linearized prior to
                        their use in blending.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_LINE_SMOOTH</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        draw lines with correct filtering.
                        Otherwise,
                        draw aliased lines.
                        See <citerefentry><refentrytitle>glLineWidth</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_MULTISAMPLE</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        use multiple fragment samples in computing the final color of a pixel.
                        See <citerefentry><refentrytitle>glSampleCoverage</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_POLYGON_OFFSET_FILL</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, and if the polygon is rendered in
                        <constant>GL_FILL</constant> mode, an offset is added to depth values of a polygon's
                        fragments before the depth comparison is performed.
                        See <citerefentry><refentrytitle>glPolygonOffset</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_POLYGON_OFFSET_LINE</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, and if the polygon is rendered in
                        <constant>GL_LINE</constant> mode, an offset is added to depth values of a polygon's
                        fragments before the depth comparison is performed.
                        See <citerefentry><refentrytitle>glPolygonOffset</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_POLYGON_OFFSET_POINT</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, an offset is added to depth values of a polygon's fragments
                        before the depth comparison is performed, if the polygon is rendered in
                        <constant>GL_POINT</constant> mode. See <citerefentry><refentrytitle>glPolygonOffset</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_POLYGON_SMOOTH</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, draw polygons with proper filtering.
                        Otherwise, draw aliased polygons. For correct antialiased polygons,
                        an alpha buffer is needed and the polygons must be sorted front to
                        back.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_PRIMITIVE_RESTART</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        Enables primitive restarting.  If enabled, any one of the draw commands
                        which transfers a set of generic attribute array elements to the GL will restart
                        the primitive when the index of the vertex is equal to the primitive restart index.
                        See <citerefentry><refentrytitle>glPrimitiveRestartIndex</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_PRIMITIVE_RESTART_FIXED_INDEX</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        Enables primitive restarting with a fixed index. If enabled, any one of the
                        draw commands which transfers a set of generic attribute array elements to the GL will
                        restart the primitive when the index of the vertex is equal to the fixed primitive
                        index for the specified index type. The fixed index is equal to
                        <inlineequation><mml:math><mml:msup><mml:mn>2</mml:mn><mml:mi>n</mml:mi></mml:msup><mml:mo>&minus;</mml:mo><mml:mn>1</mml:mn></mml:math></inlineequation>
                        where <emphasis>n</emphasis> is equal to 8 for <constant>GL_UNSIGNED_BYTE</constant>,
                        16 for <constant>GL_UNSIGNED_SHORT</constant> and 32 for <constant>GL_UNSIGNED_INT</constant>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_RASTERIZER_DISCARD</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        primitives are discarded after the optional transform feedback stage,
                        but before rasterization. Furthermore, when enabled, <citerefentry><refentrytitle>glClear</refentrytitle></citerefentry>,
                        <citerefentry><refentrytitle>glClearBufferData</refentrytitle></citerefentry>,
                        <citerefentry><refentrytitle>glClearBufferSubData</refentrytitle></citerefentry>,
                        <citerefentry><refentrytitle>glClearTexImage</refentrytitle></citerefentry>, and
                        <citerefentry><refentrytitle>glClearTexSubImage</refentrytitle></citerefentry> are ignored.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SAMPLE_ALPHA_TO_COVERAGE</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        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.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SAMPLE_ALPHA_TO_ONE</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        each sample alpha value is replaced by the maximum representable alpha value.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SAMPLE_COVERAGE</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        the fragment's coverage is ANDed with the temporary coverage value.  If
                        <constant>GL_SAMPLE_COVERAGE_INVERT</constant> is set to <constant>GL_TRUE</constant>, invert the coverage
                        value.
                        See <citerefentry><refentrytitle>glSampleCoverage</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SAMPLE_SHADING</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, the active fragment shader is run once for each covered sample, or at
                        fraction of this rate as determined by the current value of <constant>GL_MIN_SAMPLE_SHADING_VALUE</constant>.
                        See <citerefentry><refentrytitle>glMinSampleShading</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SAMPLE_MASK</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, the sample coverage mask generated for a fragment during rasterization
                        will be ANDed with the value of <constant>GL_SAMPLE_MASK_VALUE</constant> before
                        shading occurs.
                        See <citerefentry><refentrytitle>glSampleMaski</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SCISSOR_TEST</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        discard fragments that are outside the scissor rectangle.
                        See <citerefentry><refentrytitle>glScissor</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_STENCIL_TEST</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled,
                        do stencil testing and update the stencil buffer.
                        See <citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_TEXTURE_CUBE_MAP_SEAMLESS</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled, cubemap textures are sampled such that when linearly sampling from the border
                        between two adjacent faces, texels from both faces are used to generate the final sample
                        value. When disabled, texels from only a single face are used to construct the final
                        sample value.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_PROGRAM_POINT_SIZE</constant></term>
                <listitem>
                <para>
                </para>
                    <para>
                        If enabled
                        and a vertex or geometry shader is active, then the derived point size is taken from the (potentially clipped) shader builtin
                        <constant>gl_PointSize</constant> and clamped to the implementation-dependent point size range.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>cap</parameter> is not one of the values
            listed previously.
        </para>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated by <function>glEnablei</function> and <function>glDisablei</function>
            if <parameter>index</parameter> is greater than or equal to the number of indexed capabilities for <parameter>cap</parameter>.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <constant>GL_PRIMITIVE_RESTART</constant> is available only if the GL version is 3.1 or greater.
        </para>
        <para>
            <constant>GL_TEXTURE_CUBE_MAP_SEAMLESS</constant> is available only if the GL version is 3.2 or greater.
        </para>
        <para>
            <constant>GL_PRIMITIVE_RESTART_FIXED_INDEX</constant> is available only if the GL version is 4.3 or greater.
        </para>
        <para>
            <constant>GL_DEBUG_OUTPUT</constant> and <constant>GL_DEBUG_OUTPUT_SYNCHRONOUS</constant> are available only if the GL version is 4.3 or greater.
        </para>
        <para>
            Any token accepted by <function>glEnable</function> or <function>glDisable</function> is also accepted by
            <function>glEnablei</function> and <function>glDisablei</function>, but if the capability is not indexed,
            the maximum value that <parameter>index</parameter> may take is zero.
        </para>
        <para>
            In general, passing an indexed capability to <function>glEnable</function> or <function>glDisable</function>
            will enable or disable that capability for all indices, resepectively.
        </para>
    </refsect1>
    <refsect1 id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBlendFunc</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glCullFace</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDepthFunc</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDepthRange</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLineWidth</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLogicOp</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPointSize</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPolygonMode</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPolygonOffset</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glSampleCoverage</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glScissor</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 1991-2006 Silicon Graphics, Inc.
            Copyright <trademark class="copyright"></trademark> 2011-2013 Khronos Group.
            This document is licensed under the SGI
            Free Software B License. For details, see
            <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
        </para>
    </refsect1>
</refentry>
