GL_EXT_texture_buffer#
Supported Hardware#
Series6, Series6XE, Series6XT
Valid APIs#
OpenGL ES 3.1
Description#
This extension adds a way to effectively treat a buffer as a 1-dimensional texture, and sample from that buffer in a shader. This is done by attaching a buffer object as the data store for a texture, in place of the TexStorage* or TexImage* functions.
This allows applications to have access to a linear texture in memory which can be mapped into CPU space and the data can be manipulated more readily than typically opaque textures.
Example#
// Bind a texture object
GLuint textureObject;
glBindTexture(GL_TEXTURE_2D, textureObject);
// Set a buffer as the bound texture object's data store, with RGBA8 data
GLuint bufferObject;
glTexBufferEXT(GL_TEXTURE_2D, GL_RGBA8, bufferobject);
[Example]
#extension GL_EXT_texture_buffer : require
uniform samplerBuffer myTextureBuffer;
in float textureBufferCoords;
void main()
{
...
// Sample the texture buffer.
vec4 value = texture(myTextureBuffer, textureBufferCoords);
...
}