<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>

<!-- Converted by db4-upgrade version 1.1 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="glCopyBufferSubData">
    <info>
        <copyright>
            <year>2010-2014</year>
            <holder>Khronos Group</holder>
        </copyright>
    </info>
    <refmeta>
        <refentrytitle>glCopyBufferSubData</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glCopyBufferSubData</refname>
        <refpurpose>copy part of the data store of a buffer object to the data store of another buffer object</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glCopyBufferSubData</function></funcdef>
                <paramdef>GLenum <parameter>readtarget</parameter></paramdef>
                <paramdef>GLenum <parameter>writetarget</parameter></paramdef>
                <paramdef>GLintptr <parameter>readoffset</parameter></paramdef>
                <paramdef>GLintptr <parameter>writeoffset</parameter></paramdef>
                <paramdef>GLsizeiptr <parameter>size</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>readtarget</parameter></term>
            <listitem>
                <para>
                    Specifies the target from whose data store data should be read.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>writetarget</parameter></term>
            <listitem>
                <para>
                    Specifies the target to whose data store data should be written.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>readoffset</parameter></term>
            <listitem>
                <para>
                    Specifies the offset, in basic machine units, within the data store of <parameter>readtarget</parameter> from which data should be read.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>writeoffset</parameter></term>
            <listitem>
                <para>
                    Specifies the offset, in basic machine units, within the data store of <parameter>writetarget</parameter> to which data should be written.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>size</parameter></term>
            <listitem>
                <para>
                    Specifies the size, in basic machine units, of the data to be copied from <parameter>readtarget</parameter> to <parameter>writetarget</parameter>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            <function>glCopyBufferSubData</function> copies part of the data store attached to <parameter>readtarget</parameter> to the
            data store attached to <parameter>writetarget</parameter>. The number of basic machine units indicated by <parameter>size</parameter>
            is copied from the source, at offset <parameter>readoffset</parameter> to the destination at <parameter>writeoffset</parameter>,
            also in basic machine units.
        </para>
        <para>
            <parameter>readtarget</parameter> and <parameter>writetarget</parameter> must be <constant>GL_ARRAY_BUFFER</constant>,
            <constant>GL_COPY_READ_BUFFER</constant>, <constant>GL_COPY_WRITE_BUFFER</constant>, <constant>GL_ELEMENT_ARRAY_BUFFER</constant>,
            <constant>GL_PIXEL_PACK_BUFFER</constant>, <constant>GL_PIXEL_UNPACK_BUFFER</constant>,
            <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant> or <constant>GL_UNIFORM_BUFFER</constant>. Any of these targets may be used,
            although the targets <constant>GL_COPY_READ_BUFFER</constant> and <constant>GL_COPY_WRITE_BUFFER</constant> are provided
            specifically to allow copies between buffers without disturbing other GL state.
        </para>
        <para>
            <parameter>readoffset</parameter>, <parameter>writeoffset</parameter> and <parameter>size</parameter> must all be greater than or equal to
            zero. Furthermore, <parameter>readoffset</parameter> + <parameter>size</parameter> must not exceeed the size of the buffer
            object bound to <parameter>readtarget</parameter>, and <parameter>writeoffset</parameter> + <parameter>size</parameter> must not exceeed the
            size of the buffer bound to <parameter>writetarget</parameter>. If the same buffer object is bound to both <parameter>readtarget</parameter>
            and <parameter>writetarget</parameter>, then the ranges specified by <parameter>readoffset</parameter>, <parameter>writeoffset</parameter>
            and <parameter>size</parameter> must not overlap.
        </para>
    </refsect1>
    <refsect1 xml:id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if any of <parameter>readoffset</parameter>, <parameter>writeoffset</parameter>
            or <parameter>size</parameter> is negative, if <parameter>readoffset</parameter> + <parameter>size</parameter> exceeds the
            size of the buffer object bound to <parameter>readtarget</parameter> or if <parameter>writeoffset</parameter> + <parameter>size</parameter>
            exceeds the size of the buffer object bound to <parameter>writetarget</parameter>.
        </para>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if the same buffer object is bound to both <parameter>readtarget</parameter>
            and <parameter>writetarget</parameter> and the ranges [<parameter>readoffset</parameter>, <parameter>readoffset</parameter> +
            <parameter>size</parameter>) and [<parameter>writeoffset</parameter>, <parameter>writeoffset</parameter> + <parameter>size</parameter>)
            overlap.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if zero is bound to <parameter>readtarget</parameter> or <parameter>writetarget</parameter>.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if the buffer object bound to either <parameter>readtarget</parameter> or <parameter>writetarget</parameter>
            is mapped.
        </para>
    </refsect1>
    <refsect1 xml:id="versions">
        <title>API Version Support</title>
        <informaltable>
            <tgroup cols="3" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry>glCopyBufferSubData</entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='es30']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glGenBuffers</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBufferData</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBufferSubData</refentrytitle></citerefentry>,
        </para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 2010-2014 Khronos Group.
            This material may be distributed subject to the terms and conditions set forth in
            the Open Publication License, v 1.0, 8 June 1999.
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
        </para>
    </refsect1>
</refentry>
