
<refentry id="glXCreatePbuffer">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glXCreatePbuffer</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glXCreatePbuffer</refname>
        <refpurpose>create an off-screen rendering area</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>GLXPbuffer <function>glXCreatePbuffer</function></funcdef>
                <paramdef>Display * <parameter>dpy</parameter></paramdef>
                <paramdef>GLXFBConfig <parameter>config</parameter></paramdef>
                <paramdef>const int * <parameter>attrib_list</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 a GLXFBConfig structure with the desired attributes for the
                    window.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>attrib_list</parameter></term>
            <listitem>
                <para>
                    Specifies a list of attribute value pairs, which must be terminated with
                    <constant>None</constant> or <constant>NULL</constant>. Accepted attributes are
                    <constant>GLX_PBUFFER_WIDTH</constant>, <constant>GLX_PBUFFER_HEIGHT</constant>, 
                    <constant>GLX_PRESERVED_CONTENTS</constant>, and <constant>GLX_LARGEST_PBUFFER</constant>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glXCreatePbuffer</function> creates an off-screen rendering area and returns its XID.
            Any GLX rendering context that was created with respect to <parameter>config</parameter>
            can be used to render into this window.
            Use <citerefentry><refentrytitle>glXMakeContextCurrent</refentrytitle></citerefentry> to associate the rendering area with a GLX
            rendering context.
        </para>
        <para>
            The accepted attributes for a GLXPbuffer are:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GLX_PBUFFER_WIDTH</constant></term>
                <listitem>
                    <para>
                        Specify the pixel width of the requested GLXPbuffer. The default value
                        is 0.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GLX_PBUFFER_HEIGHT</constant></term>
                <listitem>
                    <para>
                        Specify the pixel height of the requested GLXPbuffer. The default value
                        is 0.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GLX_LARGEST_PBUFFER</constant></term>
                <listitem>
                    <para>
                        Specify to obtain the largest available pixel buffer, if the requested
                        allocation would have failed. The width and height of the allocated
                        pixel buffer will never exceed the specified <constant>GLX_PBUFFER_WIDTH</constant> or
                        <constant>GLX_PBUFFER_HEIGHT</constant>, respectively.  Use <citerefentry><refentrytitle>glXQueryDrawable</refentrytitle></citerefentry> to
                        retrieve the dimensions of the allocated pixel buffer. The default value is
                        <constant>False</constant>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GLX_PRESERVED_CONTENTS</constant></term>
                <listitem>
                    <para>
                        Specify if the contents of the pixel buffer should be preserved when a
                        resource conflict occurs.  If set to <constant>False</constant>, the contents of the 
                        pixel buffer may be lost at any time.  If set to <constant>True</constant>, or not
                        specified in <parameter>attrib_list</parameter>, then the contents of the pixel buffer will be preserved 
                        (most likely by copying the contents into main system memory from the
                        frame buffer).  In either case, the client can register (using
                        <citerefentry><refentrytitle>glXSelectEvent</refentrytitle></citerefentry>, to receive
                        pixel buffer clobber events that are generated when the pbuffer contents have
                        been preserved or damaged.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
        <para>
            GLXPbuffers contain the color and ancillary buffers specified by
            <parameter>config</parameter>.  It is possible to create a pixel buffer with back buffers and
            to swap those buffers using <citerefentry><refentrytitle>glXSwapBuffers</refentrytitle></citerefentry>.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <function>glXCreatePbuffer</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>
        <para>
            GLXPbuffers are allocated from frame buffer resources; applications
            should consider deallocating them when they are not in use.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>BadAlloc</constant> is generated if there are insufficient resources to
            allocate the requested GLXPbuffer.
        </para>
        <para>
            <constant>GLXBadFBConfig</constant> is generated if <parameter>config</parameter> is not a valid
            GLXFBConfig.
        </para>
        <para>
            <constant>BadMatch</constant> is generated if <parameter>config</parameter> does not support rendering to
            pixel buffers (e.g., <constant>GLX_DRAWABLE_TYPE</constant> does not contain
            <constant>GLX_PBUFFER_BIT</constant>).
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glXChooseFBConfig</refentrytitle></citerefentry>,
            <function>glXCreatePbuffer</function>,
            <citerefentry><refentrytitle>glXMakeContextCurrent</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glXSelectEvent</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>
