GLTEXSTORAGE1D(3G)
π¦ GLTEXSTORAGE1D(3G) π¦
Okay bestie, this is the GLTEXSTORAGE1D(3G) page, and the header is literally sitting there with [FIXME: manual] in it (we love a work-in-progress icon ππ
). The whole vibe: set up storage for all levels of a one-dimensional texture at once. No cap.
β¨ NAME β¨
glTexStorage1D, glTextureStorage1D β simultaneously specify storage for all levels of a one-dimensional texture. Periodt. π
π C SPECIFICATION π
void glTexStorage1D(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width);
void glTextureStorage1D(GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width);
π PARAMETERS π
targetβ tells you which target the texture object is bound to forglTexStorage1D. It must be one ofGL_TEXTURE_1DorGL_PROXY_TEXTURE_1D. That's the whole list, bestie. πtextureβ the texture object name forglTextureStorage1D. Its effective target must be one of the valid non-proxy target values above. So no proxy shenanigans here, okay? π«Άlevelsβ the number of texture levels. Yep, plural, because we're doing all of them at once.internalformatβ the sized internal format that'll be used to store texture image data. Sized is the key word, iykyk. β¨widthβ the width of the texture, in texels. Texels! Not pixels! Very important distinction, bestie. π¦
πΈ DESCRIPTION πΈ
glTexStorage1D and glTextureStorage1D specify the storage requirements for all levels of a one-dimensional texture simultaneously. It's giving "do it in one shot" energy, and honestly? Obsessed. π₯
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. She's locked in. π
Calling glTexStorage1D is equivalent, assuming no errors are generated, to executing the following pseudo-code:
for (i = 0; i < levels; i++) {
glTexImage1D(target, i, internalformat, width, 0, format, type, NULL);
width = max(1, (width / 2));
}
Calling glTextureStorage1D 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 glTexImage1D. Literally the same energy, just with a texture object name instead. π«
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. So don't stress about those, bestie β they're not the main character here. π
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. That's the whole approved list β no improvising. π
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. So you can check the vibe later. π
No further changes to the dimensions or format of the texture object may be made. Using any command that might alter the dimensions or format of the texture object (such as glTexImage1D() or another call to glTexStorage1D) will result in the generation of a GL_INVALID_OPERATION error, even if it would not, in fact, alter the dimensions or format of the object. So likeβ¦ don't try it. The rules are the rules, and this texture is immutable-format now. πβ¨
...and here's the big one, bestie β Table 1. Sized Internal Formats β literally the whole glow-up menu in one place. Scan it, screenshot it, save it to your notes app, whatever. It's giving reference chart energy and honestly? Iconic. π
Columns go: Sized Internal Format, Base Internal Format, then the bit counts for Red, Green, Blue, Alpha, and finally Shared Bits β and yeah, that last column is straight-up empty for every single row here, so don't come for me, I'm just transcribing. π
Sized Internal Format | Base Internal Format | Red Bits | Green Bits | Blue Bits | Alpha Bits | Shared Bits
----------------------+----------------------+----------+------------+-----------+------------+------------
GL_R8 | GL_RED | 8 | | | |
GL_R8_SNORM | GL_RED | s8 | | | |
GL_R16 | GL_RED | 16 | | | |
GL_R16_SNORM | GL_RED | s16 | | | |
GL_RG8 | GL_RG | 8 | 8 | | |
GL_RG8_SNORM | GL_RG | s8 | s8 | | |
GL_RG16 | GL_RG | 16 | 16 | | |
GL_RG16_SNORM | GL_RG | s16 | s16 | | |
GL_R3_G3_B2 | GL_RGB | 3 | 3 | 2 | |
GL_RGB4 | GL_RGB | 4 | 4 | 4 | |
GL_RGB5 | GL_RGB | 5 | 5 | 5 | |
GL_RGB8 | GL_RGB | 8 | 8 | 8 | |
GL_RGB8_SNORM | GL_RGB | s8 | s8 | s8 | |
GL_RGB10 | GL_RGB | 10 | 10 | 10 | |
GL_RGB12 | GL_RGB | 12 | 12 | 12 | |
GL_RGB16_SNORM | GL_RGB | 16 | 16 | 16 | |
GL_RGBA2 | GL_RGB | 2 | 2 | 2 | 2 |
GL_RGBA4 | GL_RGB | 4 | 4 | 4 | 4 |
GL_RGB5_A1 | GL_RGBA | 5 | 5 | 5 | 1 |
GL_RGBA8 | GL_RGBA | 8 | 8 | 8 | 8 |
GL_RGBA8_SNORM | GL_RGBA | s8 | s8 | s8 | s8 |
GL_RGB10_A2 | GL_RGBA | 10 | 10 | 10 | 2 |
GL_RGB10_A2UI | GL_RGBA | ui10 | ui10 | ui10 | ui2 |
GL_RGBA12 | GL_RGBA | 12 | 12 | 12 | 12 |
GL_RGBA16 | GL_RGBA | 16 | 16 | 16 | 16 |
GL_SRGB8 | GL_RGB | 8 | 8 | 8 | |
GL_SRGB8_ALPHA8 | GL_RGBA | 8 | 8 | 8 | 8 |
GL_R16F | GL_RED | f16 | | | |
Quick vibe check on how to read this, because the bit columns are doing the most:
- Plain numbers like
8,16,10,3β those are the bit counts, no drama. πΈ s8/s16β the s is right there in the name, babe, it's the signed-ish-flavoured vari.ui10/ui2β onlyGL_RGB10_A2UIgets these, and honestly it ate. That's the only row in this whole chunk reppinguianything. πf16β floating-point bits, showing up exactly once here onGL_R16F. β¨- And yes,
GL_RGBA2andGL_RGBA4both list their Base Internal Format asGL_RGB, notGL_RGBA. I am literally just the messenger, do not shoot me π β the table says what the table says.
Also don't @ me about the empty cells β they're empty in the source and they stay empty here. GL_R3_G3_B2 is the only three-channel row that skips 4, 5 and 8 and goes straight for 3/3/2, which, sure, quirky, we love a nonconformist. π¦
And the list keeps going β GL_R16F is not the last word, bestie...
β¦and the table just keeps going, bestie π so here's the next chunk. Reminder of what the columns mean: internal format first, then the format it pairs with, then what R, G, B and A are each stored as, plus that last shared-exponent column β which is blank on basically everything here except the one icon that literally needs it π
GL_RG16FβformatisGL_RG; R isf16, G isf16β¨GL_RGB16FβformatisGL_RGB; R isf16, G isf16, B isf16β¨GL_RGBA16FβformatisGL_RGBA; R isf16, G isf16, B isf16, A isf16β¨GL_R32FβformatisGL_RED; R isf32π₯GL_RG32FβformatisGL_RG; R isf32, G isf32π₯GL_RGB32FβformatisGL_RGB; R isf32, G isf32, B isf32π₯GL_RGBA32FβformatisGL_RGBA; R isf32, G isf32, B isf32, A isf32π₯GL_R11F_G11F_B10FβformatisGL_RGB; R isf11, G isf11, B isf10(three channels, no A, and yes the B one is onlyf10, that's not a typo π )GL_RGB9_E5βformatisGL_RGB; R is9, G is9, B is9, and the shared exponent column is5π this is the special oneGL_R8IβformatisGL_RED; R isi8GL_R8UIβformatisGL_RED; R isui8GL_R16IβformatisGL_RED; R isi16GL_R16UIβformatisGL_RED; R isui16GL_R32IβformatisGL_RED; R isi32GL_R32UIβformatisGL_RED; R isui32GL_RG8IβformatisGL_RG; R isi8, G isi8GL_RG8UIβformatisGL_RG; R isui8, G isui8GL_RG16IβformatisGL_RG; R isi16, G isi16GL_RG16UIβformatisGL_RG; R isui16, G isui16GL_RG32IβformatisGL_RG; R isi32, G isi32GL_RG32UIβformatisGL_RG; R isui32, G isui32GL_RGB8IβformatisGL_RGB; R isi8, G isi8, B isi8GL_RGB8UIβformatisGL_RGB; R isui8, G isui8, B isui8GL_RGB16IβformatisGL_RGB; R isi16, G isi16, B isi16GL_RGB16UIβformatisGL_RGB; R isui16, G isui16, B isui16GL_RGB32IβformatisGL_RGB; R isi32, G isi32, B isi32GL_RGB32UIβformatisGL_RGB; R isui32, G isui32, B isui32GL_RGBA8IβformatisGL_RGBA; R isi8, G isi8, B isi8, A isi8GL_RGBA8UIβformatisGL_RGBA; R isui8, G isui8, B isui8, A isui8GL_RGBA16IβformatisGL_RGBA; R isi16, G isi16, B isi16, A isi16GL_RGBA16UIβformatisGL_RGBA; R isui16, G isui16, B isui16, A isui16
see how the pattern goes? once you clock the i/ui prefix and the bit count, you can basically read these like a group chat handle π the table's not done though β keep going π«Ά
β¦okay so wrapping up that internal-format table, here's the last little chunk of it β same columns as before, no cap:
βββββββββββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββββΌββββββββββββΌβββββββββββββΌβββββββββ€
β GL_RGBA32I β GL_RGBA β i32 β i32 β i32 β i32 β β
βββββββββββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββββΌββββββββββββΌβββββββββββββΌβββββββββ€
β GL_RGBA32UI β GL_RGBA β ui32 β ui32 β ui32 β ui32 β β
βββββββββββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββββ΄ββββββββββββ΄βββββββββββββ΄βββββββββ
And that's the whole table, bestie, we survived πβ¨
π«Ά NOTES
Okay so tiny little footnote but it MATTERS: GL_STENCIL_INDEX8 is accepted for internalformat only if the GL version is 4.4 or higher. That's it, that's the note. Like, it's giving "you must be this tall to ride" π’ β on anything older it's just not happening.
π ERRORS
Bestie, here's where you find out what you did wrong. All the ways to get yelled at:
GL_INVALID_OPERATIONβ generated byglTexStorage1Dif zero is bound totarget. Yeah, you gotta have something bound, babe π―GL_INVALID_OPERATIONβ generated byglTextureStorage1Dif texture is not the name of an existing texture object. Ghost texture energy π» not a vibe.GL_INVALID_ENUMβ generated if internalformat is not a valid sized internal format.GL_INVALID_ENUMβ generated if target, or the effective target of texture, is not one of the accepted targets described above.GL_INVALID_VALUEβ generated if width or levels is less than 1. Zero and negative are NOT slaying here π ββοΈGL_INVALID_OPERATIONβ generated if levels is greater than log 2 width + 1. Like the mip levels have to actually fit, periodt.
Lowkey if you're getting one of these at 2am, it's almost always the "zero bound to target" one. Just saying π
π VERSION SUPPORT
Okay the moment you've been waiting for: the β¨compatibility chartβ¨. β means slay, - means not yet, girl.
ββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β 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 β β β β β β β β β β β β β
ββββββββββββββββββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
β glTexStorage1D β - β - β - β - β - β - β - β - β β β β β β β β β
ββββββββββββββββββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
β glTextureStorage1D β - β - β - β - β - β - β - β - β - β - β - β β β
ββββββββββββββββββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
So real talk: glTexStorage1D shows up starting at OpenGL 4.2 and rides all the way through 4.5 π while glTextureStorage1D is a total 4.5-only exclusive β the newest-new, main character energy only β¨ And everything from 2.0 through 4.1 for both? Dashes. Nope. Not invited to the party π
π¦ SEE ALSO
Go read these when you're done here, iykyk:
glTexImage1D()glTexStorage2D()glTexStorage3D()
π COPYRIGHT
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 Β© 2011-2014 Khronos Group
And that's a wrap, bestie!! π«ΆπΈ This page is from the source [FIXME: source], dated 08/09/2021, and it lives at GLTEXSTORAGE1D(3G) in the manual. Go forth and allocate your 1D texture storage responsibly, love u, bye ππ
π¦ 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