<!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="glGetFramebufferAttachmentParameteriv">
    <info>
        <copyright>
            <year>2010-2015</year>
            <holder>Khronos Group</holder>
        </copyright>
    </info>
    <refmeta>
        <refentrytitle>glGetFramebufferAttachmentParameteriv</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glGetFramebufferAttachmentParameteriv</refname>
        <refpurpose>retrieve information about attachments of a bound framebuffer object</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glGetFramebufferAttachmentParameteriv</function></funcdef>
                <paramdef>GLenum <parameter>target</parameter></paramdef>
                <paramdef>GLenum <parameter>attachment</parameter></paramdef>
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
                <paramdef>GLint *<parameter>params</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>target</parameter></term>
            <listitem>
                <para>
                    Specifies the target of the query operation.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>attachment</parameter></term>
            <listitem>
                <para>
                    Specifies the attachment within <parameter>target</parameter>
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>pname</parameter></term>
            <listitem>
                <para>
                    Specifies the parameter of <parameter>attachment</parameter> to query.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>params</parameter></term>
            <listitem>
                <para>
                    Specifies the address of a variable receive the value of <parameter>pname</parameter> for <parameter>attachment</parameter>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            <function>glGetFramebufferAttachmentParameteriv</function> returns information about attachments of a bound framebuffer
            object. <parameter>target</parameter> specifies the framebuffer binding point and must be <constant>GL_DRAW_FRAMEBUFFER</constant>,
            <constant>GL_READ_FRAMEBUFFER</constant> or <constant>GL_FRAMEBUFFER</constant>. <constant>GL_FRAMEBUFFER</constant> is equivalent
            to <constant>GL_DRAW_FRAMEBUFFER</constant>.
        </para>
        <para>
            If the default framebuffer is bound to <parameter>target</parameter> then <parameter>attachment</parameter> must be one of
            <constant>GL_BACK</constant>, identifying a color buffer, <constant>GL_DEPTH</constant>, identifying the depth buffer,
            or <constant>GL_STENCIL</constant>, identifying the stencil buffer.
        </para>
        <para>
            If a framebuffer object is bound, then
            <parameter>attachment</parameter> must be one of
            <constant>GL_COLOR_ATTACHMENT</constant><emphasis>i</emphasis>,
            <constant>GL_DEPTH_ATTACHMENT</constant>,
            <constant>GL_STENCIL_ATTACHMENT</constant>, or
            <constant>GL_DEPTH_STENCIL_ATTACHMENT</constant>.
            <emphasis>i</emphasis> in
            <constant>GL_COLOR_ATTACHMENT</constant><emphasis>i</emphasis>
            must be in the range zero to the value of
            <constant>GL_MAX_COLOR_ATTACHMENTS</constant> minus one.
        </para>
        <para>
            If <parameter>attachment</parameter> is <constant>GL_DEPTH_STENCIL_ATTACHMENT</constant> and different objects are bound
            to the depth and stencil attachment points of <parameter>target</parameter> the query will fail. If the same object
            is bound to both attachment points, information about that object will be returned.
        </para>
        <para>
            Upon successful return from <function>glGetFramebufferAttachmentParameteriv</function>,  if <parameter>pname</parameter> is
            <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant>, then <parameter>params</parameter> will contain one of <constant>GL_NONE</constant>,
            <constant>GL_FRAMEBUFFER_DEFAULT</constant>, <constant>GL_TEXTURE</constant>, or <constant>GL_RENDERBUFFER</constant>, identifying the type of
            object which contains the attached image.  Other values accepted for <parameter>pname</parameter> depend on the type of object, as described below.
        </para>
        <para>
            If the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant> is <constant>GL_NONE</constant>, no framebuffer is bound to
            <parameter>target</parameter>. In this case querying <parameter>pname</parameter> <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant>
            will return zero, and all other queries will generate an error.
        </para>
        <para>
            If the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant> is not <constant>GL_NONE</constant>, these queries apply to all other
            framebuffer types:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE</constant>,
                    <constant>GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE</constant>, <constant>GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE</constant>,
                    <constant>GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE</constant>, <constant>GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE</constant>,
                    or <constant>GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE</constant>, then <parameter>params</parameter> will contain the number
                    of bits in the corresponding red, green, blue, alpha, depth, or stencil component of the specified attachment. Zero is returned
                    if the requested component is not present in <parameter>attachment</parameter>.
                </para>
            </listitem>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE</constant>, <parameter>params</parameter> will
                    contain the format of components of the specified attachment, one of <constant>GL_FLOAT</constant>, <parameter>GL_INT</parameter>,
                    <parameter>GL_UNSIGNED_INT</parameter>, <parameter>GL_SIGNED_NORMALIZED</parameter>, or <parameter>GL_UNSIGNED_NORMALIZED</parameter>
                    for floating-point, signed integer, unsigned integer, signed normalized fixed-point, or unsigned normalized fixed-point components
                    respectively. Only color buffers may have  integer components.
                </para>
            </listitem>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</constant>, <parameter>param</parameter> will
                    contain the encoding of components of the specified attachment, one of <constant>GL_LINEAR</constant> or <constant>GL_SRGB</constant>
                    for linear or sRGB-encoded components, respectively. Only color buffer components may be sRGB-encoded.
                    For the default framebuffer, color encoding is determined by the implementation.
                    For framebuffer objects, components are sRGB-encoded if the internal format of a color attachment is one of the color-renderable SRGB
                    formats.
                </para>
            </listitem>
        </itemizedlist>
        <para>
            If the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant> is <constant>GL_RENDERBUFFER</constant>, then:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant>, <parameter>params</parameter> will contain
                    the name of the renderbuffer object which contains the attached image.
                </para>
            </listitem>
        </itemizedlist>
        <para>
            If the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant> is <constant>GL_TEXTURE</constant>, then:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant>, then <parameter>params</parameter> will
                    contain the name of the texture object which contains the attached image.
                </para>
            </listitem>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL</constant>, then <parameter>params</parameter>
                    will contain the mipmap level of the texture object which contains the attached image.
                </para>
            </listitem>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE</constant> and the texture object named
                    <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant> is a cube map texture, then <parameter>params</parameter> will contain the cube map
                    face of the cubemap texture object which contains the attached image.  Otherwise <parameter>params</parameter> will contain the value
                    zero.
                </para>
            </listitem>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is
                    <constant>GL_FRAMEBUFFER_ATTACHMENT_LAYERED</constant>,
                    then <parameter>params</parameter> will contain
                    <constant>GL_TRUE</constant> if an entire level of a
                    three-dimensional texture, cube map texture, two-dimensional array, 
                    or two-dimensional multisample array texture is attached. Otherwise,
                    <parameter>params</parameter> will contain
                    <constant>GL_FALSE</constant>.
                </para>
            </listitem>
            <listitem>
                <para>
                    If <parameter>pname</parameter> is <constant>GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER</constant> and the texture object named
                    <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant> is a three-dimensional texture or a two-dimensional
                    array texture, and the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_LAYERED</constant> is <constant>GL_FALSE</constant>, 
                    then <parameter>params</parameter> will contain the number of the texture layer which contains the attached image.
                    Otherwise <parameter>params</parameter> will contain the value zero.
                </para>
            </listitem>
        </itemizedlist>
        <para>
            Any combinations of framebuffer type and <parameter>pname</parameter> not described above will generate an error.
        </para>
    </refsect1>
    <refsect1 xml:id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the accepted tokens.
        </para>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>pname</parameter> is not valid for the value of
            <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant>.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>attachment</parameter> is not the accepted values
            for <parameter>target</parameter>.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>attachment</parameter> is <constant>GL_DEPTH_STENCIL_ATTACHMENT</constant>
            and different objects are bound to the depth and stencil attachment points of <parameter>target</parameter>.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant> is
            <constant>GL_NONE</constant> and <parameter>pname</parameter> is not <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant>.
        </para>
    </refsect1>
    <refsect1 xml:id="versions">
        <title>API Version Support</title>
        <informaltable>
            <tgroup cols="5" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry>glGetFramebufferAttachmentParameteriv</entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='es20']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glGenFramebuffers</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBindFramebuffer</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 2010-2015 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>
