<?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="glXCreateNewContext">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glXCreateNewContext</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glXCreateNewContext</refname>
        <refpurpose>create a new GLX rendering context</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>GLXContext <function>glXCreateNewContext</function></funcdef>
                <paramdef>Display * <parameter>dpy</parameter></paramdef>
                <paramdef>GLXFBConfig <parameter>config</parameter></paramdef>
                <paramdef>int <parameter>render_type</parameter></paramdef>
                <paramdef>GLXContext <parameter>share_list</parameter></paramdef>
                <paramdef>Bool <parameter>direct</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>dpy</parameter></term>
            <listitem>
                <para>
                    Specifies the connection to the X server.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>config</parameter></term>
            <listitem>
                <para>
                    Specifies the GLXFBConfig structure with the desired attributes for the
                    context.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>render_type</parameter></term>
            <listitem>
                <para>
                    Specifies the type of the context to be created.  Must be one of
                    <constant>GLX_RGBA_TYPE</constant> or <constant>GLX_COLOR_INDEX_TYPE</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>share_list</parameter></term>
            <listitem>
                <para>
                    Specifies the context with which to share display lists.
                    <constant>NULL</constant> indicates that no sharing is to take place.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>share_list</parameter></term>
            <listitem>
                <para>
                    Specifies whether rendering is to be done with a direct connection
                    to the graphics system if possible (<constant>True</constant>)
                    or through the X server (<constant>False</constant>).
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glXCreateNewContext</function> creates a GLX rendering context and returns its handle.
            This context can be used to render into GLX windows, pixmaps, or pixel 
            buffers.
            If <function>glXCreateNewContext</function> fails to create a rendering context,
            <constant>NULL</constant> is returned.
        </para>
        <para>
            If <parameter>render_type</parameter> is <constant>GLX_RGBA_TYPE</constant>, then a context that supports RGBA
            rendering is created.  If <parameter>config</parameter> is <constant>GLX_COLOR_INDEX_TYPE</constant>, then
            context supporting color-index rendering is created.
        </para>
        <para>
            If <parameter>render_type</parameter> is not <constant>NULL</constant>,
            then all display-list indexes and definitions are shared by
            context <parameter>render_type</parameter> and by the newly created context.
            An arbitrary number of contexts can share a single display-list space.
            However,
            all rendering contexts that share a single display-list space must
            themselves exist in the same address space.
            Two rendering contexts share an address space if both are nondirect
            using the same server,
            or if both are direct and owned by a single process.
            Note that in the nondirect case, it is not necessary for the calling
            threads to share an address space,
            only for their related rendering contexts to share an address space.
        </para>
        <para>
            If <parameter>share_list</parameter> is <constant>True</constant>,
            then a direct-rendering context is created if the
            implementation supports direct rendering, if the connection is to an X
            server that is local, and if a direct-rendering context is available. (An implementation may return an indirect context when <parameter>share_list</parameter> is <constant>True</constant>.)
            If <parameter>share_list</parameter> is <constant>False</constant>,
            then a rendering context that renders through the X server is always created.
            Direct rendering provides a performance advantage in some implementations.
            However, direct-rendering contexts cannot be shared outside a single process,
            and they may be unable to render to GLX pixmaps.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <function>glXCreateNewContext</function> is available only if the GLX version is 1.3 or greater.
        </para>
        <para>
            If the GLX version is 1.1 or 1.0, the GL version must be 1.0.
            If the GLX version is 1.2, then the GL version must be 1.1.
            If the GLX version is 1.3, then the GL version must be 1.2.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>NULL</constant> is returned if execution fails on the client side.
        </para>
        <para>
            <constant>GLXBadContext</constant> is generated if <parameter>render_type</parameter> is not a GLX context
            and is not <constant>NULL</constant>.
        </para>
        <para>
            <constant>GLXBadFBConfig</constant> is generated if <parameter>config</parameter> is not a valid
            GLXFBConfig.
        </para>
        <para>
            <constant>BadMatch</constant> is generated if the context to be created would not
            share the address space or the screen of the context specified by <parameter>render_type</parameter>.
        </para>
        <para>
            <constant>BadAlloc</constant> is generated if the server does not have enough
            resources to allocate the new context.
        </para>
        <para>
            <constant>BadValue</constant> is generated if <parameter>config</parameter> is not a valid visual (for
            example, if a particular GLX implementation does not support it).
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glXChooseFBConfig</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXCreateContext</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXDestroyContext</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXGetFBConfigs</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXGetFBConfigAttrib</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXIsDirect</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXMakeContextCurrent</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 1991-2006
            Silicon Graphics, Inc. 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>
