<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glTexBuffer - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glTexBuffer"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glTexBuffer — attach the storage for a buffer object to the active buffer texture</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexBuffer</b>(</code></td><td>GLenum  </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">internalFormat</var>, </td></tr><tr><td> </td><td>GLuint  </td><td><var class="pdparam">buffer</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p>
                    Specifies the target of the operation and must be <code class="constant">GL_TEXTURE_BUFFER</code>.
                </p></dd><dt><span class="term"><em class="parameter"><code>internalFormat</code></em></span></dt><dd><p>
                    Specifies the internal format of the data in the store belonging to <em class="parameter"><code>buffer</code></em>.
                </p></dd><dt><span class="term"><em class="parameter"><code>buffer</code></em></span></dt><dd><p>
                    Specifies the name of the buffer object whose storage to attach to the active buffer texture.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glTexBuffer</code> attaches the storage for the buffer object named <em class="parameter"><code>buffer</code></em> to the active
            buffer texture, and specifies the internal format for the texel array found in the attached buffer object. If <em class="parameter"><code>buffer</code></em>
            is zero, any buffer object attached to the buffer texture is detached and no new buffer object is attached. If <em class="parameter"><code>buffer</code></em>
            is non-zero, it must be the name of an existing buffer object. <em class="parameter"><code>target</code></em> must be <code class="constant">GL_TEXTURE_BUFFER</code>.
            <em class="parameter"><code>internalformat</code></em> specifies the storage format, and must be one of the following sized internal formats:
        </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th rowspan="2" align="center"> </th><th rowspan="2" align="center"> </th><th rowspan="2" align="center"> </th><th rowspan="2" align="center"> </th><th colspan="4" align="left"><span class="bold"><strong>
                        Component
                        </strong></span></th></tr></thead><tbody><tr><td align="left"><span class="bold"><strong>Sized Internal Format</strong></span></td><td align="left"><span class="bold"><strong>Base Type</strong></span></td><td align="left"><span class="bold"><strong>Components</strong></span></td><td align="left"><span class="bold"><strong>Norm</strong></span></td><td align="center">0</td><td align="center">1</td><td align="center">2</td><td align="center">3</td></tr><tr><td align="left"><code class="constant">GL_R8</code></td><td align="left">ubyte</td><td align="left">1</td><td align="left">YES</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R16</code></td><td align="left">ushort</td><td align="left">1</td><td align="left">YES</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R16F</code></td><td align="left">half</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R32F</code></td><td align="left">float</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R8I</code></td><td align="left">byte</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R16I</code></td><td align="left">short</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R32I</code></td><td align="left">int</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R8UI</code></td><td align="left">ubyte</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R16UI</code></td><td align="left">ushort</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_R32UI</code></td><td align="left">uint</td><td align="left">1</td><td align="left">NO</td><td align="center">R</td><td align="center">0</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG8</code></td><td align="left">ubyte</td><td align="left">2</td><td align="left">YES</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG16</code></td><td align="left">ushort</td><td align="left">2</td><td align="left">YES</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG16F</code></td><td align="left">half</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG32F</code></td><td align="left">float</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG8I</code></td><td align="left">byte</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG16I</code></td><td align="left">short</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG32I</code></td><td align="left">int</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG8UI</code></td><td align="left">ubyte</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG16UI</code></td><td align="left">ushort</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RG32UI</code></td><td align="left">uint</td><td align="left">2</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">0</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RGB32F</code></td><td align="left">float</td><td align="left">3</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RGB32I</code></td><td align="left">int</td><td align="left">3</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RGB32UI</code></td><td align="left">uint</td><td align="left">3</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">1</td></tr><tr><td align="left"><code class="constant">GL_RGBA8</code></td><td align="left">uint</td><td align="left">4</td><td align="left">YES</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA16</code></td><td align="left">short</td><td align="left">4</td><td align="left">YES</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA16F</code></td><td align="left">half</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA32F</code></td><td align="left">float</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA8I</code></td><td align="left">byte</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA16I</code></td><td align="left">short</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA32I</code></td><td align="left">int</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA8UI</code></td><td align="left">ubyte</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA16UI</code></td><td align="left">ushort</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr><tr><td align="left"><code class="constant">GL_RGBA32UI</code></td><td align="left">uint</td><td align="left">4</td><td align="left">NO</td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td></tr></tbody></table></div><p>
            When a buffer object is attached to a buffer texture, the buffer object's data store
            is taken as the texture's texel array.  The number of texels in the buffer texture's
            texel array is given by
        </p><mml:apply xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:floor definitionURL="" encoding=""></mml:floor>
                <mml:mfrac>
                    <mml:mrow>
                        <mml:mi>buffer_size</mml:mi>
                    </mml:mrow>
                    <mml:mrow>
                        <mml:mi>components</mml:mi><mml:mo> </mml:mo><mml:csymbol encoding="" definitionURL=""><mml:mo>×</mml:mo></mml:csymbol><mml:mo> </mml:mo><mml:mi>sizeof</mml:mi><mml:mo>(</mml:mo><mml:mi>base_type</mml:mi><mml:mo>)</mml:mo>
                    </mml:mrow>
                </mml:mfrac>
            </mml:apply><p>
            where <span class="emphasis"><em>buffer_size</em></span> is the size of the buffer object, in basic machine units and
            components and base type are the element count and base data type for elements, as specified in the table above.
            The number of texels in the texel array is then clamped to the implementation-dependent limit <code class="constant">GL_MAX_TEXTURE_BUFFER_SIZE</code>.
            When a buffer texture is accessed in a shader, the results of a texel fetch are undefined if the specified texel coordinate is negative, or
            greater than or equal to the clamped number of texels in the texel array.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>target</code></em> is not <code class="constant">GL_TEXTURE_BUFFER</code>.
        </p><p>
            <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>internalFormat</code></em> is not one of the accepted tokens.
        </p><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>buffer</code></em> is not zero or the name of an existing buffer object.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
            <code class="function">glTexBuffer</code> is available only if the GL version is 3.1 or greater.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p><a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>
    with argument <code class="constant">GL_MAX_TEXTURE_BUFFER_SIZE</code></p><p><a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>
    with argument <code class="constant">GL_TEXTURE_BINDING_BUFFER</code></p><p><a href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a>
    with argument <code class="constant">GL_TEXTURE_BUFFER_DATA_STORE_BINDING</code></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a href="glGenBuffers.xml"><span class="citerefentry"><span class="refentrytitle">glGenBuffers</span></span></a>,
            <a href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>,
            <a href="glBufferData.xml"><span class="citerefentry"><span class="refentrytitle">glBufferData</span></span></a>,
            <a href="glDeleteBuffers.xml"><span class="citerefentry"><span class="refentrytitle">glDeleteBuffers</span></span></a>,
            <a href="glGenTextures.xml"><span class="citerefentry"><span class="refentrytitle">glGenTextures</span></span></a>,
            <a href="glBindTexture.xml"><span class="citerefentry"><span class="refentrytitle">glBindTexture</span></span></a>,
            <a href="glDeleteTextures.xml"><span class="citerefentry"><span class="refentrytitle">glDeleteTextures</span></span></a>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 2010-2013 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.
            <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
        </p></div></div></body></html>
