<?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="glFramebufferRenderbuffer">
    <refmeta>
	<refentrytitle>glFramebufferRenderbuffer</refentrytitle>
	<manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
	<refname>glFramebufferRenderbuffer</refname>
	<refpurpose>attach a renderbuffer object to a framebuffer object</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
	<funcsynopsis>
	    <funcprototype>
		<funcdef>void <function>glFramebufferRenderbuffer</function></funcdef>
		<paramdef>GLenum <parameter>target</parameter></paramdef>
		<paramdef>GLenum <parameter>attachment</parameter></paramdef>
		<paramdef>GLenum <parameter>renderbuffertarget</parameter></paramdef>
		<paramdef>GLuint <parameter>renderbuffer</parameter></paramdef>
	    </funcprototype>
	</funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
	<variablelist>
	    <varlistentry>
		<term><parameter>target</parameter></term>
		<listitem>
		    <para>Specifies the framebuffer target. The symbolic constant must be
		    <constant>GL_FRAMEBUFFER</constant>.</para>
		</listitem>
	    </varlistentry>
	    <varlistentry>
		<term><parameter>attachment</parameter></term>
		<listitem>
		    <para>Specifies the attachment point to which 
		    <parameter>renderbuffer</parameter> should be attached. Must be one of the
		    following symbolic constants:
		    <constant>GL_COLOR_ATTACHMENT0</constant>,
		    <constant>GL_DEPTH_ATTACHMENT</constant>, or
		    <constant>GL_STENCIL_ATTACHMENT</constant>.</para>
		</listitem>
	    </varlistentry>
	    <varlistentry>
		<term><parameter>renderbuffertarget</parameter></term>
		<listitem>
		    <para>Specifies the renderbuffer target. The symbolic constant must be
		    <constant>GL_RENDERBUFFER</constant>.</para>
		</listitem>
	    </varlistentry>
	    <varlistentry>
		<term><parameter>renderbuffer</parameter></term>
		<listitem>
		    <para>Specifies the renderbuffer object that is to be attached.</para>
		</listitem>
	    </varlistentry>
	</variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
	<para><function>glFramebufferRenderbuffer</function> attaches the 
	renderbuffer specified by <parameter>renderbuffer</parameter> as 
	one of the logical buffers of the currently bound framebuffer object.
	<parameter>attachment</parameter> specifies whether the renderbuffer
	should be attached to the framebuffer object's color, depth, or 
	stencil buffer. A renderbuffer may not be attached to the default
	framebuffer object name 0.</para>

	<para>If <parameter>renderbuffer</parameter> is not 0, the value of
	<constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant> for the
	specified attachment point is set to <constant>GL_RENDERBUFFER</constant>
	and the value of <constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant>
	is set to <parameter>renderbuffer</parameter>. 
	<constant>GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL</constant> and
	<constant>GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE</constant> are
	set to the default values 0 and <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X</constant>, 
	respectively. Any previous attachment to the <parameter>attachment</parameter>
	logical buffer of the currently bound framebuffer object is broken.</para>

	<para>If <parameter>renderbuffer</parameter> is 0, the current image, if any, attached to
	the <parameter>attachment</parameter> logical buffer of the currently bound
	framebuffer object is detached. The value of 
	<constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</constant> is set to 
	<constant>GL_NONE</constant>. The value of 
	<constant>GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</constant> is set to 0.
	<constant>GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL</constant> and
	<constant>GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE</constant> are
	set to the default values 0 and <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X</constant>, 
	respectively.</para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            If a renderbuffer object is deleted while its image is attached to the currently
            bound framebuffer, then it is as if <function>glFramebufferRenderbuffer</function>
            had been called with a <parameter>renderbuffer</parameter> of 0 for the attachment
            point to which this image was attached in the currently bound framebuffer object.
            In other words, the renderbuffer image is detached from the currently bound
            framebuffer. Note that the renderbuffer image is specifically <emphasis>not</emphasis>
            detached from any non-bound framebuffers. Detaching the image from any non-bound 
            framebuffers is the responsibility of the application.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
	<para><constant>GL_INVALID_ENUM</constant> is generated if
	<parameter>target</parameter> is not <constant>GL_FRAMEBUFFER</constant>.</para>

	<para><constant>GL_INVALID_ENUM</constant> is generated if
	<parameter>renderbuffertarget</parameter> is not <constant>GL_RENDERBUFFER</constant> and
	<parameter>renderbuffer</parameter> is not 0.</para>

	<para><constant>GL_INVALID_ENUM</constant> is generated if
	<parameter>attachment</parameter> is not an accepted attachment point.</para>

	<para><constant>GL_INVALID_OPERATION</constant> is generated if
	the default framebuffer object name 0 is bound.</para>

	<para><constant>GL_INVALID_OPERATION</constant> is generated if
	<parameter>renderbuffer</parameter> is neither 0 nor the name of an existing 
	renderbuffer object.</para>
    </refsect1>
    <refsect1 id="associatedgets"><title>Associated Gets</title>
	<para><citerefentry><refentrytitle>glGetFramebufferAttachmentParameteriv</refentrytitle></citerefentry></para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
	<para><citerefentry><refentrytitle>glBindFramebuffer</refentrytitle></citerefentry>,
	<citerefentry><refentrytitle>glBindRenderbuffer</refentrytitle></citerefentry>,
	<citerefentry><refentrytitle>glCheckFramebufferStatus</refentrytitle></citerefentry>,
	<citerefentry><refentrytitle>glDeleteFramebuffers</refentrytitle></citerefentry>,
	<citerefentry><refentrytitle>glDeleteRenderbuffers</refentrytitle></citerefentry>,
	<citerefentry><refentrytitle>glFramebufferTexture2D</refentrytitle></citerefentry>,
	<citerefentry><refentrytitle>glGetFramebufferAttachmentParameteriv</refentrytitle></citerefentry>,
	<citerefentry><refentrytitle>glRenderbufferStorage</refentrytitle></citerefentry></para>
    </refsect1>
    <refsect1 id="copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 2008 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.
            <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
        </para>
    </refsect1>
</refentry>

