GLBINDIMAGETEXTURE(3G)
β¨ GLBINDIMAGETEXTURE(3G) β bind a level of a texture to an image unit β¨
okay bestie, welcome to the GLBINDIMAGETEXTURE(3G) page β manual name 3G, and yes the original header literally says [FIXME: manual], we are choosing to ignore that mess and focus on the lore π
πΈ NAME πΈ
glBindImageTexture β bind a level of a texture to an image unit
π» C SPECIFICATION π»
void glBindImageTexture(GLuint unit, GLuint texture, GLint level,
GLboolean layered, GLint layer, GLenum access,
GLenum format);
π PARAMETERS π
unitβ the index of the image unit you're binding the texture to, bestie.textureβ the name of the texture that's getting bound to the image unit.levelβ which level of the texture is getting bound. yes, that level.layeredβ tells us whether a layered texture binding is being established.layerβ iflayeredisGL_FALSE, this says which layer of the texture gets bound to the image unit. ignored otherwise, so don't stress it.accessβ a token that says what kind of access is gonna happen on the image.formatβ the format that the image's elements get treated as for formatted stores.
π¦ DESCRIPTION π¦
okay so glBindImageTexture binds a single level of a texture to an image unit so shaders can read from it and write to it. unit is the zero-based index of the image unit where the texture level goes. texture is the name of an existing texture object to bind to that image unit. and if texture is zero? boom, any existing binding to the image unit is broken. level is the level of the texture being bound to the image unit. iconic.
if texture is the name of a one-, two-, or three-dimensional array texture, a cube map or cube map array texture, or a two-dimensional multisample array texture, then you can bind either the entire array or just a single layer of the array to the image unit. in those cases:
- if
layeredisGL_TRUE, the entire array is attached to the image unit andlayeris ignored. - if
layeredisGL_FALSE, thenlayerspecifies the layer of the array to attach to the image unit.
access specifies the access types that shaders will perform, and it can be set to GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE to mean read-only, write-only, or read-write access, respectively. and listen: violating the access type in access β like if a shader writes to an image bound with access set to GL_READ_ONLY β leads to undefined results, possibly including program termination. not a vibe, do not do it π
format specifies the format used when performing formatted stores into the image from shaders. format must be compatible with the texture's internal format and must be one of the formats listed in the following table. here's the whole compatibility roster, no skips:
π Table 1. Internal Image Formats π
GL_RGBA32Fβrgba32fGL_RGBA16Fβrgba16fGL_RG32Fβrg32fGL_RG16Fβrg16fGL_R11F_G11F_B10Fβr11f_g11f_b10fGL_R32Fβr32fGL_R16Fβr16fGL_RGBA32UIβrgba32uiGL_RGBA16UIβrgba16uiGL_RGB10_A2UIβrgb10_a2uiGL_RGBA8UIβrgba8uiGL_RG32UIβrg32uiGL_RG16UIβrg16uiGL_RG8UIβrg8uiGL_R32UIβr32uiGL_R16UIβr16uiGL_R8UIβr8uiGL_RGBA32Iβrgba32iGL_RGBA16Iβrgba16iGL_RGBA8Iβrgba8iGL_RG32Iβrg32iGL_RG16Iβrg16iGL_RG8Iβrg8iGL_R32Iβr32iGL_R16Iβr16iGL_R8Iβr8iGL_RGBA16βrgba16GL_RGB10_A2βrgb10_a2GL_RGBA8βrgba8GL_RG16βrg16GL_RG8βrg8GL_R16βr16GL_R8βr8GL_RGBA16_SNORMβrgba16_snormGL_RGBA8_SNORMβrgba8_snormGL_RG16_SNORMβrg16_snormGL_RG8_SNORMβrg8_snormGL_R16_SNORMβr16_snormGL_R8_SNORMβr8_snorm
when a texture is bound to an image unit, the format parameter for the image unit does not need to exactly match the texture's internal format, as long as the formats are considered compatible as defined in the OpenGL Specification. the matching criterion used for a given texture may be determined by calling glGetTexParameter() with value set to GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, with return values of GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE and GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS, specifying matches by size and class, respectively. iykyk π§
β NOTES β
glBindImageTexture is available only if the GL version is 4.2 or greater. that's the whole note, bestie β short and slay.
π ERRORS π
GL_INVALID_VALUEis generated ifunitis greater than or equal to the value ofGL_MAX_IMAGE_UNITS.GL_INVALID_VALUEis generated iftextureis not the name of an existing texture object.GL_INVALID_VALUEis generated iflevelorlayeris less than zero.GL_INVALID_ENUMis generated ifaccessorformatis not one of the supported tokens.
π ASSOCIATED GETS π
okay bestie, these are the glGet() queries associated with this whole situation β if you need to check the binding later, this is the exact list:
glGet()with argumentGL_IMAGE_BINDING_NAME.glGet()with argumentGL_IMAGE_BINDING_LEVEL.glGet()with argumentGL_IMAGE_BINDING_LAYERED.glGet()with argumentGL_IMAGE_BINDING_LAYER.glGet()with argumentGL_IMAGE_BINDING_ACCESS.glGet()with argumentGL_IMAGE_BINDING_FORMAT.
π VERSION SUPPORT π
the columns are Function / Feature Name and OpenGL Version, and glBindImageTexture is literally the main character here. here's every single version cell, no cap:
- OpenGL
2.0βglBindImageTextureβ- - OpenGL
2.1βglBindImageTextureβ- - OpenGL
3.0βglBindImageTextureβ- - OpenGL
3.1βglBindImageTextureβ- - OpenGL
3.2βglBindImageTextureβ- - OpenGL
3.3βglBindImageTextureβ- - OpenGL
4.0βglBindImageTextureβ- - OpenGL
4.1βglBindImageTextureβ- - OpenGL
4.2βglBindImageTextureββ - OpenGL
4.3βglBindImageTextureββ - OpenGL
4.4βglBindImageTextureββ - OpenGL
4.5βglBindImageTextureββ
that's the whole support table preserved cell by cell, bestie β¨
π¦ SEE ALSO π¦
go peek at these besties when you're done:
glGenTextures()glTexImage1D()glTexImage2D()glTexImage3D()glTexStorage1D()glTexStorage2D()glTexStorage3D()glBindTexture()
π COPYRIGHT π
keeping this exactly as it is, because legal text is not the vibe to paraphrase:
Copyright Β© 2011-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. http://opencontent.org/openpub/.
π COPYRIGHT π
and yep, there's a second copyright line β still keeping it exact:
Copyright Β© 2011-2014 Khronos Group
and that's the page, bestie π«Ά footer deets: source [FIXME: source], dated 08/09/2021, and the page is GLBINDIMAGETEXTURE(3G). mwah π
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms