GLTEXSTORAGE3D(3G)
π¦ GLTEXSTORAGE3D(3G) π¦
okay bestie, welcome to the GLTEXSTORAGE3D(3G) page from the [FIXME: manual] manual. itβs giving βtexture storage, but make it immutableβ energy, and honestly? iconic. no cap, this one is about glTexStorage3D and glTextureStorage3D setting up storage for all levels at once. π
β¨
π NAME π
glTexStorage3D, glTextureStorage3D β bestie, they simultaneously specify storage for all levels of a three-dimensional, two-dimensional array or cube-map array texture. thatβs the whole name vibe. π«Ά
π C SPECIFICATION π
hereβs the C spec, and yes, the signatures stay exactly like this:
void glTexStorage3D(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth);
void glTextureStorage3D(GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth);
π PARAMETERS π
okay, parameter time β every single one of these matters, bestie:
targetβ forglTexStorage3D, this specifies the target to which the texture object is bound. it must be one ofGL_TEXTURE_3D,GL_TEXTURE_2D_ARRAY,GL_TEXTURE_CUBE_MAP_ARRAY,GL_PROXY_TEXTURE_3D,GL_PROXY_TEXTURE_2D_ARRAYorGL_PROXY_TEXTURE_CUBE_MAP_ARRAY. πtextureβ forglTextureStorage3D, this specifies the texture object name. the effective target oftexturemust be one of the valid non-proxy target values above. π«Άlevelsβ this specifies the number of texture levels. lowkey important. β¨internalformatβ this specifies the sized internal format to be used to store texture image data. πwidthβ this specifies the width of the texture, in texels. πΈheightβ this specifies the height of the texture, in texels. π¦depthβ this specifies the depth of the texture, in texels. π
β¨ DESCRIPTION β¨
okay so glTexStorage3D and glTextureStorage3D specify the storage requirements for all levels of a three-dimensional, two-dimensional array or cube-map array texture simultaneously. once a texture is specified with this command, the format and dimensions of all levels become immutable unless it is a proxy texture. the contents of the image may still be modified, however, its storage requirements may not change. such a texture is referred to as an immutable-format texture. π
the behavior of glTexStorage3D depends on the target parameter. when target is GL_TEXTURE_3D, or GL_PROXY_TEXTURE_3D, calling glTexStorage3D is equivalent, assuming no errors are generated, to executing the following pseudo-code: π§
for (i = 0; i < levels; i++) {
glTexImage3D(target, i, internalformat, width, height, depth, 0, format, type, NULL);
width = max(1, (width / 2));
height = max(1, (height / 2));
depth = max(1, (depth / 2));
}
when target is GL_TEXTURE_2D_ARRAY, GL_PROXY_TEXTURE_2D_ARRAY, GL_TEXTURE_CUBE_MAP_ARRAY, or GL_PROXY_TEXTURE_CUBE_MAP_ARRAY, glTexStorage3D is equivalent to: πΈ
for (i = 0; i < levels; i++) {
glTexImage3D(target, i, internalformat, width, height, depth, 0, format, type, NULL);
width = max(1, (width / 2));
height = max(1, (height / 2));
}
calling glTextureStorage3D is equivalent to the above pseudo-code, where target is the effective target of texture and it is as if texture were bound to target for the purposes of glTexImage3D. π«Ά
since no texture data is actually provided, the values used in the pseudo-code for format and type are irrelevant and may be considered to be any values that are legal for the chosen internalformat enumerant. internalformat must be one of the sized internal formats given in Table 1 below, one of the sized depth-component formats GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT16, one of the combined depth-stencil formats, GL_DEPTH32F_STENCIL8, or GL_DEPTH24_STENCIL8, or the stencil-only format, GL_STENCIL_INDEX8. β¨
upon success, the value of GL_TEXTURE_IMMUTABLE_FORMAT becomes GL_TRUE. the value of GL_TEXTURE_IMMUTABLE_FORMAT may be discovered by calling glGetTexParameter() with pname set to GL_TEXTURE_IMMUTABLE_FORMAT. no further changes to the dimensions or format of the texture object may be made. π
π¨ bestie, this is the serious part: using any command that might alter the dimensions or format of the texture object (such asglTexImage3D()or another call toglTexStorage3D) will result in the generation of aGL_INVALID_OPERATIONerror, even if it would not, in fact, alter the dimensions or format of the object. π
πΈ Table 1. Sized Internal Formats πΈ
Okay bestie, this is the big table and it's a whole moment, so let me set the scene. Every row gives you the Sized Internal Format, the Base Internal Format it maps to, then how many bits go to red, green, blue and alpha, plus a Shared Bits column. Heads up: the Shared Bits column is blank for literally every single row in the original, so I'm not gonna keep writing "and nothing shared" twenty-eight times. Also, wherever the original table leaves a bit-count cell empty, I just don't mention that channel. Everything else? Copied over exactly. π
GL_R8β baseGL_RED; red 8 bitsGL_R8_SNORMβ baseGL_RED; red s8GL_R16β baseGL_RED; red 16 bitsGL_R16_SNORMβ baseGL_RED; red s16GL_RG8β baseGL_RG; red 8, green 8GL_RG8_SNORMβ baseGL_RG; red s8, green s8GL_RG16β baseGL_RG; red 16, green 16GL_RG16_SNORMβ baseGL_RG; red s16, green s16GL_R3_G3_B2β baseGL_RGB; red 3, green 3, blue 2GL_RGB4β baseGL_RGB; red 4, green 4, blue 4GL_RGB5β baseGL_RGB; red 5, green 5, blue 5GL_RGB8β baseGL_RGB; red 8, green 8, blue 8GL_RGB8_SNORMβ baseGL_RGB; red s8, green s8, blue s8GL_RGB10β baseGL_RGB; red 10, green 10, blue 10GL_RGB12β baseGL_RGB; red 12, green 12, blue 12GL_RGB16_SNORMβ baseGL_RGB; red 16, green 16, blue 16GL_RGBA2β baseGL_RGB; red 2, green 2, blue 2, alpha 2GL_RGBA4β baseGL_RGB; red 4, green 4, blue 4, alpha 4GL_RGB5_A1β baseGL_RGBA; red 5, green 5, blue 5, alpha 1GL_RGBA8β baseGL_RGBA; red 8, green 8, blue 8, alpha 8GL_RGBA8_SNORMβ baseGL_RGBA; red s8, green s8, blue s8, alpha s8GL_RGB10_A2β baseGL_RGBA; red 10, green 10, blue 10, alpha 2GL_RGB10_A2UIβ baseGL_RGBA; red ui10, green ui10, blue ui10, alpha ui2GL_RGBA12β baseGL_RGBA; red 12, green 12, blue 12, alpha 12GL_RGBA16β baseGL_RGBA; red 16, green 16, blue 16, alpha 16GL_SRGB8β baseGL_RGB; red 8, green 8, blue 8GL_SRGB8_ALPHA8β baseGL_RGBA; red 8, green 8, blue 8, alpha 8GL_R16Fβ baseGL_RED; red f16
And yeah, before anyone in the group chat comes for me β GL_RGBA2 and GL_RGBA4 really do list GL_RGB as their base internal format in the original table, not GL_RGBA. I'm not touching it. That's exactly what it says, bestie. π«Ά
okay so picking right back up with the rest of the format table, bestie β same deal as before, just keep reading down the list π each row is the sized internal format, then its base internal format, then the channel layout in order:
GL_RG16Fβ baseGL_RG, channelsf16,f16GL_RGB16Fβ baseGL_RGB, channelsf16,f16,f16GL_RGBA16Fβ baseGL_RGBA, channelsf16,f16,f16,f16GL_R32Fβ baseGL_RED, channelf32GL_RG32Fβ baseGL_RG, channelsf32,f32GL_RGB32Fβ baseGL_RGB, channelsf32,f32,f32GL_RGBA32Fβ baseGL_RGBA, channelsf32,f32,f32,f32GL_R11F_G11F_B10Fβ baseGL_RGB, channelsf11,f11,f10GL_RGB9_E5β baseGL_RGB, channels9,9,9, plus shared5GL_R8Iβ baseGL_RED, channeli8GL_R8UIβ baseGL_RED, channelui8GL_R16Iβ baseGL_RED, channeli16GL_R16UIβ baseGL_RED, channelui16GL_R32Iβ baseGL_RED, channeli32GL_R32UIβ baseGL_RED, channelui32GL_RG8Iβ baseGL_RG, channelsi8,i8GL_RG8UIβ baseGL_RG, channelsui8,ui8GL_RG16Iβ baseGL_RG, channelsi16,i16GL_RG16UIβ baseGL_RG, channelsui16,ui16GL_RG32Iβ baseGL_RG, channelsi32,i32GL_RG32UIβ baseGL_RG, channelsui32,ui32GL_RGB8Iβ baseGL_RGB, channelsi8,i8,i8GL_RGB8UIβ baseGL_RGB, channelsui8,ui8,ui8GL_RGB16Iβ baseGL_RGB, channelsi16,i16,i16GL_RGB16UIβ baseGL_RGB, channelsui16,ui16,ui16GL_RGB32Iβ baseGL_RGB, channelsi32,i32,i32GL_RGB32UIβ baseGL_RGB, channelsui32,ui32,ui32GL_RGBA8Iβ baseGL_RGBA, channelsi8,i8,i8,i8GL_RGBA8UIβ baseGL_RGBA, channelsui8,ui8,ui8,ui8GL_RGBA16Iβ baseGL_RGBA, channelsi16,i16,i16,i16GL_RGBA16UIβ baseGL_RGBA, channelsui16,ui16,ui16,ui16
likeβ¦ look at all those integer formats living their best life π¦ and yes, the i / ui split is literally signed vs unsigned, no cap β keep scrolling, we're not done yet β¨
βββββββββββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββββΌββββββββββββΌβββββββββββββΌβββββββββ€
β GL_RGBA32I β GL_RGBA β i32 β i32 β i32 β i32 β β
βββββββββββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββββΌββββββββββββΌβββββββββββββΌβββββββββ€
β GL_RGBA32UI β GL_RGBA β ui32 β ui32 β ui32 β ui32 β β
βββββββββββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββββ΄ββββββββββββ΄βββββββββββββ΄βββββββββ
and that's the whole table, bestie β she's done, she's complete, we can all go home πβ¨
π NOTES (the fine print era) π§
GL_STENCIL_INDEX8is accepted forinternalformatonly if the GL version is4.4or higher. Like, it's invite-only, and the guest list starts at 4.4. No gatecrashing on 4.3, sorry babe π
π ERRORS (aka the ways to break it, ngl) π
Listen β every single one of these is a little "no ma'am" from the driver. Learn them, love them, avoid them π«Ά
GL_INVALID_OPERATIONβ generated byglTexStorage3Dif zero is bound totarget. Bestie. You have to have something bound. Zero is not a texture, it's a vibe, and not the good kind.GL_INVALID_OPERATIONβ generated byglTextureStorage3Diftextureis not the name of an existing texture object. If the name doesn't exist, we're not manifesting it into existence, that's not how this works β¨GL_INVALID_ENUMβ generated ifinternalformatis not a valid sized internal format. Sized, diva. The size is the whole point.GL_INVALID_ENUMβ generated iftargetor the effective target oftextureis not one of the accepted targets described above. Color outside the accepted-targets lines and the enum gets mad.GL_INVALID_VALUEβ generated ifwidth,height,depthorlevelsare less than1. Anything below one is lowkey nothing, and nothing is not a dimension, periodt.GL_INVALID_OPERATIONβ generated iftargetisGL_TEXTURE_3DorGL_PROXY_TEXTURE_3Dandlevelsis greater thanlog 2 max width,height,depth + 1.GL_INVALID_OPERATIONβ generated iftargetisGL_TEXTURE_2D_ARRAY,GL_PROXY_TEXTURE_2D_ARRAY,GL_TEXURE_CUBE_MAP_ARRAY, orGL_PROXY_TEXTURE_CUBE_MAP_ARRAYandlevelsis greater thanlog 2 max width,height + 1.
Ok real talk β yes, that last one says GL_TEXURE_CUBE_MAP_ARRAY, and no, I did not misspell it, that is character for character what the page says. Not me fixing it, not my job, we keep it exactly as written ππ
π VERSION SUPPORT (the "is this even available" chart) π
ββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β OpenGL Version β
ββββββββββββββββββββββΌββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ€
β Function β 2.0 β 2.1 β 3.0 β 3.1 β 3.2 β 3.3 β 4.0 β 4.1 β 4.2 β 4.3 β 4.4 β 4.5 β
β / β β β β β β β β β β β β β
β Feature β β β β β β β β β β β β β
β Name β β β β β β β β β β β β β
ββββββββββββββββββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
β glTexStorage3D β - β - β - β - β - β - β - β - β β β β β β β β β
ββββββββββββββββββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
β glTextureStorage3D β - β - β - β - β - β - β - β - β - β - β - β β β
ββββββββββββββββββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
Read it and weep: glTexStorage3D shows up in 4.2 and stays for 4.2, 4.3, 4.4, 4.5 π₯ and glTextureStorage3D is a 4.5-only girlypop β literally one single check mark, main character energy, nobody else invited π
π
π¦ SEE ALSO (go read these next, iykyk) π
glTexImage3D()glTexStorage1D()glTexStorage2D()
π COPYRIGHT (she said it twice and i respect that) πΈ
Take one:
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/
Take two, the remix:
Copyright Β© 2011-2014 Khronos Group
Like, ok, iconic to list it twice β consistency queen π«Άβ¨ (both lines are legit, so here they both are, no cap.)
And that's a wrap on the whole page, bestie π This gem is ripped from source [FIXME: source], dated 08/09/2021, and answers to the name GLTEXSTORAGE3D(3G) β go forth and allocate your 3D textures responsibly, 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