
<refentry id="glXCopyContext">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glXCopyContext</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glXCopyContext</refname>
        <refpurpose>copy state from one rendering context to another</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glXCopyContext</function></funcdef>
                <paramdef>Display * <parameter>dpy</parameter></paramdef>
                <paramdef>GLXContext <parameter>src</parameter></paramdef>
                <paramdef>GLXContext <parameter>dst</parameter></paramdef>
                <paramdef>unsigned long <parameter>mask</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>src</parameter></term>
            <listitem>
                <para>
                    Specifies the source context.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>dst</parameter></term>
            <listitem>
                <para>
                    Specifies the destination context.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>mask</parameter></term>
            <listitem>
                <para>
                    Specifies which portions of <parameter>src</parameter> state are to be copied to <parameter>dst</parameter>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glXCopyContext</function> copies selected groups of state variables from <parameter>src</parameter> to <parameter>dst</parameter>.
            <parameter>mask</parameter> indicates which groups of state variables are to be copied.
            <parameter>mask</parameter> contains the bitwise OR of the same symbolic names that are
            passed to the GL command <citerefentry><refentrytitle>glPushAttrib</refentrytitle></citerefentry>.
            The single symbolic constant <constant>GLX_ALL_ATTRIB_BITS</constant> can be used to
            copy the maximum possible portion of rendering state.
        </para>
        <para>
            The copy can be done only if the renderers named by <parameter>src</parameter> and <parameter>dst</parameter>
            share an 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>
            Not all values for GL state can be copied.
            For example,
            pixel pack and unpack state,
            render mode state,
            and select and feedback state are not copied.
            The state that can be copied is exactly the state that is manipulated
            by the GL command 
            <citerefentry><refentrytitle>glPushAttrib</refentrytitle></citerefentry>.
        </para>
        <para>
            An implicit <citerefentry><refentrytitle>glFlush</refentrytitle></citerefentry> is done by <function>glXCopyContext</function> if <parameter>src</parameter> is the current
            context for the calling thread.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
        </para>
        <para>
            A <emphasis>process</emphasis> is a single execution environment,
            implemented in a single address space,
            consisting of one or more threads.
        </para>
        <para>
            A <emphasis>thread</emphasis> is one of a set of subprocesses that share
            a single address space,
            but maintain separate program counters,
            stack spaces,
            and other related global data.
            A <emphasis>thread</emphasis> that is the only member of its subprocess group
            is equivalent to a <emphasis>process</emphasis>.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>BadMatch</constant> is generated if rendering contexts <parameter>src</parameter> and <parameter>dst</parameter>
            do not share an address space
            or were not created with respect to the same screen.
        </para>
        <para>
            <constant>BadAccess</constant> is generated if <parameter>dst</parameter> is current to any thread
            (including the calling thread) at the time <function>glXCopyContext</function> is called.
        </para>
        <para>
            <constant>GLXBadCurrentWindow</constant> is generated if <parameter>src</parameter> is the current
            context and the current drawable is a window that is no longer valid.
        </para>
        <para>
            <constant>GLXBadContext</constant> is generated if either <parameter>src</parameter> or <parameter>dst</parameter> is not
            a valid GLX context.
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glPushAttrib</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXCreateContext</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXIsDirect</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>
