<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>eglChooseConfig</title><meta name="generator" content="DocBook XSL Stylesheets V1.74.0" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="eglChooseConfig"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>eglChooseConfig — 
            return a list of EGL frame buffer configurations that match specified attributes
        </p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">EGLBoolean <b class="fsfunc">eglChooseConfig</b>(</code></td><td>EGLDisplay <var class="pdparam">display</var>, </td></tr><tr><td> </td><td>EGLint const * <var class="pdparam">attrib_list</var>, </td></tr><tr><td> </td><td>EGLConfig * <var class="pdparam">configs</var>, </td></tr><tr><td> </td><td>EGLint <var class="pdparam">config_size</var>, </td></tr><tr><td> </td><td>EGLint * <var class="pdparam">num_config</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>display</code></em></span></dt><dd><p>Specifies the EGL display connection.</p></dd><dt><span class="term"><em class="parameter"><code>attrib_list</code></em></span></dt><dd><p>Specifies attributes required to match by configs.</p></dd><dt><span class="term"><em class="parameter"><code>configs</code></em></span></dt><dd><p>Returns an array of frame buffer configurations.</p></dd><dt><span class="term"><em class="parameter"><code>config_size</code></em></span></dt><dd><p>Specifies the size of the array of frame buffer configurations.</p></dd><dt><span class="term"><em class="parameter"><code>num_config</code></em></span></dt><dd><p>Returns the number of frame buffer configurations returned.</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            <code class="function">eglChooseConfig</code> returns a list of all
            <acronym class="acronym">EGL</acronym> frame buffer configurations that match the
            attributes specified in <em class="parameter"><code>attrib_list</code></em>.
            The items in the list can be used in any
            <acronym class="acronym">EGL</acronym>
            function that requires an
            <acronym class="acronym">EGL</acronym>
            frame buffer configuration.
        </p><p>
            <em class="parameter"><code>configs</code></em>
            does not return values, if it is specified as
            <code class="constant">NULL</code>.
            This is useful for querying just the number of matching frame buffer
            configurations.
        </p><p>
            All attributes in <em class="parameter"><code>attrib_list</code></em>,
            including boolean attributes, are
            immediately followed by the corresponding desired value. The list is
            terminated with <code class="constant">EGL_NONE</code>.
            If an attribute is not specified in <em class="parameter"><code>attrib_list</code></em>
            then the default value (see below) is used (and the attribute is said to be
            specified implicitly). For example, if <code class="constant">EGL_DEPTH_SIZE</code>
            is not specified then
            it is assumed to be 0. For some attributes, the default is
            <code class="constant">EGL_DONT_CARE</code> meaning that any value is OK for this
            attribute, so the attribute will not be checked.
        </p><p>
            Attributes are matched in an attribute-specific manner.  Some of the
            attributes, such as <code class="constant">EGL_LEVEL</code>, must match the
            specified value exactly.
            Others, such as, <code class="constant">EGL_RED_SIZE</code> must meet or exceed
            the specified minimum
            values. If more than one EGL frame buffer configuration is found, then a
            list of configurations, sorted according to the ``best'' match criteria,
            is returned. The match criteria for each attribute and the exact sorting
            order is defined below.
        </p><p>
            The interpretations of the various EGL frame buffer configuration
            attributes are as follows:
        </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">EGL_BUFFER_SIZE</code></span></dt><dd><p>
                    Must be followed by a nonnegative integer that
                    indicates the desired color buffer size.
                    The smallest color buffer of at least the
                    specified size is preferred. The default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_RED_SIZE</code></span></dt><dd><p>
                    Must be followed by a nonnegative minimum size
                    specification.  If this value is zero, the
                    smallest available red buffer is preferred.
                    Otherwise, the largest available red buffer of
                    at least the minimum size is preferred.  The
                    default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_GREEN_SIZE</code></span></dt><dd><p>
                    Must be followed by a nonnegative minimum size
                    specification.  If this value is zero, the
                    smallest available green buffer is preferred.
                    Otherwise, the largest available green buffer of
                    at least the minimum size is preferred.  The
                    default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_BLUE_SIZE</code></span></dt><dd><p>
                    Must be followed by a nonnegative minimum size
                    specification.  If this value is zero, the
                    smallest available blue buffer is preferred.
                    Otherwise, the largest available blue buffer of
                    at least the minimum size is preferred.  The
                    default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_ALPHA_SIZE</code></span></dt><dd><p>
                    Must be followed by a nonnegative minimum size
                    specification.  If this value is zero, the
                    smallest available alpha buffer is preferred.
                    Otherwise, the largest available alpha buffer of
                    at least the minimum size is preferred.  The
                    default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_BIND_TO_TEXTURE_RGB</code></span></dt><dd><p>
                    Must be followed by
                    <code class="constant">EGL_DONT_CARE</code>,
                    <code class="constant">EGL_TRUE</code>, or
                    <code class="constant">EGL_FALSE</code>.
                    If <code class="constant">EGL_TRUE</code> is specified, then only frame buffer configurations
                    that support binding of color buffers to an RGB texture will be considered.
                    Currently only frame buffer configurations that support pbuffers allow this.
                    The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_BIND_TO_TEXTURE_RGBA</code></span></dt><dd><p>
                    Must be followed by
                    <code class="constant">EGL_DONT_CARE</code>,
                    <code class="constant">EGL_TRUE</code>, or
                    <code class="constant">EGL_FALSE</code>.
                    If <code class="constant">EGL_TRUE</code> is specified, then only frame buffer configurations
                    that support binding of color buffers to an RGBA texture will be considered.
                    Currently only frame buffer configurations that support pbuffers allow this.
                    The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_CONFIG_CAVEAT</code></span></dt><dd><p>
                    Must be followed by one of
                    <code class="constant">EGL_DONT_CARE</code>,
                    <code class="constant">EGL_NONE</code>,
                    <code class="constant">EGL_SLOW_CONFIG</code>,
                    <code class="constant">EGL_NON_CONFORMANT_CONFIG</code>. If
                    <code class="constant">EGL_NONE</code> is specified, then only frame buffer
                    configurations with no caveats will be
                    considered. If <code class="constant">EGL_SLOW_CONFIG</code> is specified,
                    then only slow frame buffer configurations will
                    be considered. If <code class="constant">EGL_NON_CONFORMANT_CONFIG</code> is
                    specified, then only non-conformant frame buffer
                    configurations will be considered.  The default
                    value is <code class="constant">EGL_DONT_CARE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_CONFIG_ID</code></span></dt><dd><p>
                    Must be followed by a valid ID that indicates
                    the desired EGL frame buffer configuration. When
                    a <code class="constant">EGL_CONFIG_ID</code> is specified,
                    all attributes
                    are ignored. The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_DEPTH_SIZE</code></span></dt><dd><p>
                    Must be followed by a nonnegative integer that
                    indicates the desired depth buffer size.
                    The smallest available
                    depth buffer of at least the minimum size is
                    preferred.
                    If the desired value is zero, frame buffer
                    configurations with no depth buffer are
                    preferred.  The default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_LEVEL</code></span></dt><dd><p>
                    Must be followed by an integer buffer-level
                    specification.  This specification is honored
                    exactly.  Buffer level 0 corresponds to the
                    default frame buffer of the display.  Buffer
                    level 1 is the first overlay frame buffer, level
                    two the second overlay frame buffer, and so on.
                    Negative buffer levels correspond to underlay
                    frame buffers.  The default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_NATIVE_RENDERABLE</code></span></dt><dd><p>
                    Must be followed by
                    <code class="constant">EGL_DONT_CARE</code>,
                    <code class="constant">EGL_TRUE</code>, or
                    <code class="constant">EGL_FALSE</code>.
                    If <code class="constant">EGL_TRUE</code> is
                    specified, then only frame buffer configurations
                    that allow native rendering into the surface will be
                    considered.  The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_MAX_SWAP_INTERVAL</code></span></dt><dd><p>
                    Must be followed by a integer that indicates the
                    maximum value that can be passed to eglSwapInterval.
                    The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_MIN_SWAP_INTERVAL</code></span></dt><dd><p>
                    Must be followed by a integer that indicates the
                    minimum value that can be passed to eglSwapInterval.
                    The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_SAMPLE_BUFFERS</code></span></dt><dd><p>
                    Must be followed by the minimum acceptable
                    number of multisample buffers.  Configurations
                    with the smallest number of multisample buffers
                    that meet or exceed this minimum number are
                    preferred.  Currently operation with more than
                    one multisample buffer is undefined, so only
                    values of zero or one will produce a match.  The
                    default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_SAMPLES</code></span></dt><dd><p>
                    Must be followed by the minimum number of
                    samples required in multisample buffers.
                    Configurations with the smallest number of
                    samples that meet or exceed the specified
                    minimum number are preferred.  Note that it is
                    possible for color samples in the multisample
                    buffer to have fewer bits than colors in the
                    main color buffers.  However, multisampled
                    colors maintain at least as much color
                    resolution in aggregate as the main color
                    buffers.
                </p></dd><dt><span class="term"><code class="constant">EGL_STENCIL_SIZE</code></span></dt><dd><p>
                    Must be followed by a nonnegative integer that
                    indicates the desired number of stencil
                    bitplanes.  The smallest stencil buffer of at
                    least the specified size is preferred.
                    If the desired value is zero, frame buffer
                    configurations with no stencil buffer are
                    preferred.  The default value is 0.
                </p></dd><dt><span class="term"><code class="constant">EGL_SURFACE_TYPE</code></span></dt><dd><p>
                    Must be followed by a mask indicating which EGL
                    surface types the frame buffer configuration
                    must support. Valid bits are
                    <code class="constant">EGL_WINDOW_BIT</code>,
                    <code class="constant">EGL_PBUFFER_BIT</code>, and
                    <code class="constant">EGL_PIXMAP_BIT</code>.
                    For example, if mask is set to
                    <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi>EGL_WINDOW_BIT</mml:mi><mml:mo>|</mml:mo><mml:mi>EGL_PIXMAP_BIT</mml:mi></mml:math>,
                    only frame buffer
                    configurations that support both windows and
                    pixmaps will be considered.  The default value
                    is <code class="constant">EGL_WINDOW_BIT</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_TRANSPARENT_TYPE</code></span></dt><dd><p>
                    Must be followed by one of
                    <code class="constant">EGL_NONE</code> or
                    <code class="constant">EGL_TRANSPARENT_RGB</code>.
                    If <code class="constant">EGL_NONE</code> is
                    specified, then only opaque frame buffer
                    configurations will be considered. If
                    <code class="constant">EGL_TRANSPARENT_RGB</code> is specified, then only
                    transparent frame buffer configurations
                    will be considered.
                    The default value is <code class="constant">EGL_NONE</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_TRANSPARENT_RED_VALUE</code></span></dt><dd><p>
                    Must be followed by an integer value indicating
                    the transparent red value. The value must be
                    between 0 and the maximum color buffer value for
                    red.  Only frame buffer configurations that use
                    the specified transparent red value will be
                    considered.  The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p><p>
                    This attribute is ignored unless
                    <code class="constant">EGL_TRANSPARENT_TYPE</code> is included in
                    <em class="parameter"><code>attrib_list</code></em> and specified as
                    <code class="constant">EGL_TRANSPARENT_RGB</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_TRANSPARENT_GREEN_VALUE</code></span></dt><dd><p>
                    Must be followed by an integer value indicating
                    the transparent green value. The value must be
                    between 0 and the maximum color buffer value for
                    red.  Only frame buffer configurations that use
                    the specified transparent green value will be
                    considered.  The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p><p>
                    This attribute is ignored unless
                    <code class="constant">EGL_TRANSPARENT_TYPE</code> is included in
                    <em class="parameter"><code>attrib_list</code></em> and specified as
                    <code class="constant">EGL_TRANSPARENT_RGB</code>.
                </p></dd><dt><span class="term"><code class="constant">EGL_TRANSPARENT_BLUE_VALUE</code></span></dt><dd><p>
                    Must be followed by an integer value indicating
                    the transparent blue value. The value must be
                    between 0 and the maximum color buffer value for
                    red.  Only frame buffer configurations that use
                    the specified transparent blue value will be
                    considered.  The default value is <code class="constant">EGL_DONT_CARE</code>.
                </p><p>
                    This attribute is ignored unless
                    <code class="constant">EGL_TRANSPARENT_TYPE</code> is included in
                    <em class="parameter"><code>attrib_list</code></em> and specified as
                    <code class="constant">EGL_TRANSPARENT_RGB</code>.
                </p></dd></dl></div><p>
            When more than one EGL frame buffer configuration matches the specified
            attributes, a list of matching configurations is returned. The list is
            sorted according to the following precedence rules, which are applied in
            ascending order (i.e., configurations that are considered equal by a
            lower numbered rule are sorted by the higher numbered rule):
        </p><div class="orderedlist"><ol type="1"><li><p>
                Special <code class="constant">EGL_CONFIG_CAVEAT</code>, where the precedence is
                <code class="constant">EGL_NONE</code>,
                <code class="constant">EGL_SLOW_CONFIG</code>, and
                <code class="constant">EGL_NON_CONFORMANT_CONFIG</code>.
            </p></li><li><p>
                Special larger total number of color components
                (sum of <code class="constant">EGL_RED_SIZE</code>,
                <code class="constant">EGL_GREEN_SIZE</code>,
                <code class="constant">EGL_BLUE_SIZE</code>, and
                <code class="constant">EGL_ALPHA_SIZE</code>) that have higher number
                of bits. If the requested number of bits in
                <em class="parameter"><code>attrib_list</code></em> is
                <code class="constant">0</code> or <code class="constant">EGL_DONT_CARE</code> for a particular
                color component, then the number of bits for that component is not
                considered.
            </p></li><li><p>
                Smaller <code class="constant">EGL_BUFFER_SIZE</code>.
            </p></li><li><p>
                Smaller <code class="constant">EGL_SAMPLE_BUFFERS</code>.
            </p></li><li><p>
                Smaller <code class="constant">EGL_SAMPLES</code>.
            </p></li><li><p>
                Smaller <code class="constant">EGL_DEPTH_SIZE</code>.
            </p></li><li><p>
                Smaller <code class="constant">EGL_STENCIL_SIZE</code>.
            </p></li><li><p>
                Special <code class="constant">EGL_NATIVE_VISUAL_TYPE</code> (the actual sort order is
                implementation-defined, depending on the meaning of native visual types).
            </p></li><li><p>
                Smaller <code class="constant">EGL_CONFIG_ID</code> (this is always the last sorting rule, and guarantees
                a unique ordering).
            </p></li></ol></div><p>
            <span class="type">EGLConfigs</span> are not sorted with respect
            to the parameters <code class="constant">EGL_BIND_TO_TEXTURE_RGB</code>, <code class="constant">EGL_BIND_TO_TEXTURE_RGBA</code>,
            <code class="constant">EGL_LEVEL</code>, <code class="constant">EGL_NATIVE_RENDERABLE</code>, <code class="constant">EGL_MAX_SWAP_INTERVAL</code>,
            <code class="constant">EGL_MIN_SWAP_INTERVAL</code>, <code class="constant">EGL_SURFACE_TYPE</code>, <code class="constant">EGL_TRANSPARENT_TYPE</code>,
            <code class="constant">EGL_TRANSPARENT_RED_VALUE</code>, <code class="constant">EGL_TRANSPARENT_GREEN_VALUE</code>, and
            <code class="constant">EGL_TRANSPARENT_BLUE_VALUE</code>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="examples"></a><h2>Examples</h2><p>
            The following example specifies a frame buffer configuration
            in the normal frame buffer (not an overlay or underlay). The returned
            frame buffer configuration supports at least 4 bits each of red,
            green and blue and possible
            no alpha bits. The code shown in the example may or may not have a
            depth buffer, or a stencil buffer.
        </p><pre class="programlisting">EGLint const attrib_list[] = {
        EGL_RED_SIZE, 4,
        EGL_GREEN_SIZE, 4,
        EGL_BLUE_SIZE, 4,
        EGL_NONE
};</pre></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
            <a class="citerefentry" href="eglGetConfigs.xml"><span class="citerefentry"><span class="refentrytitle">eglGetConfigs</span></span></a>
            and
            <a class="citerefentry" href="eglGetConfigAttrib.xml"><span class="citerefentry"><span class="refentrytitle">eglGetConfigAttrib</span></span></a>
            can be used to implement
            selection algorithms other than the generic one implemented by
            <code class="function">eglChooseConfig</code>. Call
            <a class="citerefentry" href="eglGetConfigs.xml"><span class="citerefentry"><span class="refentrytitle">eglGetConfigs</span></span></a>       to retrieve all the frame
            buffer configurations, or alternatively, all the
            frame buffer configurations with a particular set of attributes. Next
            call <a class="citerefentry" href="eglGetConfigAttrib.xml"><span class="citerefentry"><span class="refentrytitle">eglGetConfigAttrib</span></span></a>
            to retrieve additional attributes for the frame
            buffer configurations and then select between them.
        </p><p>
            EGL implementors are strongly discouraged, but not proscribed, from
            changing the selection algorithm used by
            <code class="function">eglChooseConfig</code>. Therefore,
            selections may change from release to release of the client-side library.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">EGL_FALSE</code>
            is returned on failure,
            <code class="constant">EGL_TRUE</code>
            otherwise.
            <em class="parameter"><code>configs</code></em>
            and <em class="parameter"><code>num_config</code></em>
            are not modified when
            <code class="constant">EGL_FALSE</code>
            is returned.
        </p><p>
            <code class="constant">EGL_BAD_DISPLAY</code> is generated if
            <em class="parameter"><code>display</code></em> is not an EGL display connection.
        </p><p>
            <code class="constant">EGL_BAD_ATTRIBUTE</code> is generated if
            <em class="parameter"><code>attribute_list</code></em> contains an invalid frame buffer
            configuration attribute or an
            attribute value that is unrecognized or out of range.
        </p><p>
            <code class="constant">EGL_NOT_INITIALIZED</code> is generated if
            <em class="parameter"><code>display</code></em> has not been initialized.
        </p><p>
            <code class="constant">EGL_BAD_PARAMETER</code> is generated if
            <em class="parameter"><code>num_config</code></em> is <code class="constant">NULL</code>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a class="citerefentry" href="eglCreateContext.xml"><span class="citerefentry"><span class="refentrytitle">eglCreateContext</span></span></a>,
            <a class="citerefentry" href="eglCreatePbufferSurface.xml"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferSurface</span></span></a>,
            <a class="citerefentry" href="eglCreatePixmapSurface.xml"><span class="citerefentry"><span class="refentrytitle">eglCreatePixmapSurface</span></span></a>,
            <a class="citerefentry" href="eglCreateWindowSurface.xml"><span class="citerefentry"><span class="refentrytitle">eglCreateWindowSurface</span></span></a>,
            <a class="citerefentry" href="eglGetConfigs.xml"><span class="citerefentry"><span class="refentrytitle">eglGetConfigs</span></span></a>,
            <a class="citerefentry" href="eglGetConfigAttrib.xml"><span class="citerefentry"><span class="refentrytitle">eglGetConfigAttrib</span></span></a>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 2003-2004
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
        </p></div></div></body></html>

