Provided by: opengl-4-man-doc_1.0~svn31251-1build1_all bug

NAME

       glTexStorage2D, glTextureStorage2D - simultaneously specify storage for all levels of a
       two-dimensional or one-dimensional array texture

C SPECIFICATION

       void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
                           GLsizei height);

       void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat,
                               GLsizei width, GLsizei height);

PARAMETERS

       target
           Specifies the target to which the texture object is bound for glTexStorage2D. Must be
           one of GL_TEXTURE_2D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_RECTANGLE, GL_PROXY_TEXTURE_2D,
           GL_PROXY_TEXTURE_1D_ARRAY, GL_PROXY_TEXTURE_RECTANGLE, or GL_PROXY_TEXTURE_CUBE_MAP.

       texture
           Specifies the texture object name for glTextureStorage2D. The effective target of
           texture must be one of the valid non-proxy target values above.

       levels
           Specify the number of texture levels.

       internalformat
           Specifies the sized internal format to be used to store texture image data.

       width
           Specifies the width of the texture, in texels.

       height
           Specifies the height of the texture, in texels.

DESCRIPTION

       glTexStorage2D and glTextureStorage2D specify the storage requirements for all levels of a
       two-dimensional texture or one-dimensional texture array 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 glTexStorage2D depends on the target parameter. When target is
       GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D, GL_TEXTURE_RECTANGLE, GL_PROXY_TEXTURE_RECTANGLE or
       GL_PROXY_TEXTURE_CUBE_MAP, calling glTexStorage2D is equivalent, assuming no errors are
       generated, to executing the following pseudo-code:

               for (i = 0; i < levels; i++) {
                   glTexImage2D(target, i, internalformat, width, height, 0, format, type, NULL);
                   width = max(1, (width / 2));
                   height = max(1, (height / 2));
               }

       When target is GL_TEXTURE_CUBE_MAP, glTexStorage2D is equivalent to:

               for (i = 0; i < levels; i++) {
                   for (face in (+X, -X, +Y, -Y, +Z, -Z)) {
                       glTexImage2D(face, i, internalformat, width, height, 0, format, type, NULL);
                   }
                   width = max(1, (width / 2));
                   height = max(1, (height / 2));
               }

       When target is GL_TEXTURE_1D or GL_TEXTURE_1D_ARRAY, glTexStorage2D is equivalent to:

               for (i = 0; i < levels; i++) {
                   glTexImage2D(target, i, internalformat, width, height, 0, format, type, NULL);
                   width = max(1, (width / 2));
               }

       Calling glTextureStorage2D 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 glTexImage2D.

       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. Using any command that might alter the
       dimensions or format of the texture object (such as glTexImage2D() or another call to
       glTexStorage2D) 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.

       Table 1. Sized Internal Formats
       ┌──────────────────┬──────────┬──────────┬────────────┬───────────┬────────────┬─────────────┐
       │SizedBaseRed BitsGreen BitsBlue BitsAlpha BitsShared Bits │
       │InternalInternal │          │            │           │            │             │
       │FormatFormat   │          │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R8GL_RED   │    8     │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R8_SNORMGL_RED   │    s8    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R16GL_RED   │    16    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R16_SNORMGL_RED   │   s16    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG8GL_RG    │    8     │     8      │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG8_SNORMGL_RG    │    s8    │     s8     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG16GL_RG    │    16    │     16     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG16_SNORMGL_RG    │   s16    │    s16     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R3_G3_B2GL_RGB   │    3     │     3      │     2     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB4GL_RGB   │    4     │     4      │     4     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB5GL_RGB   │    5     │     5      │     5     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB8GL_RGB   │    8     │     8      │     8     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB8_SNORMGL_RGB   │    s8    │     s8     │    s8     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB10GL_RGB   │    10    │     10     │    10     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB12GL_RGB   │    12    │     12     │    12     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB16_SNORMGL_RGB   │    16    │     16     │    16     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA2GL_RGB   │    2     │     2      │     2     │     2      │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA4GL_RGB   │    4     │     4      │     4     │     4      │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB5_A1GL_RGBA  │    5     │     5      │     5     │     1      │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA8GL_RGBA  │    8     │     8      │     8     │     8      │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA8_SNORMGL_RGBA  │    s8    │     s8     │    s8     │     s8     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB10_A2GL_RGBA  │    10    │     10     │    10     │     2      │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB10_A2UIGL_RGBA  │   ui10   │    ui10    │   ui10    │    ui2     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA12GL_RGBA  │    12    │     12     │    12     │     12     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA16GL_RGBA  │    16    │     16     │    16     │     16     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_SRGB8GL_RGB   │    8     │     8      │     8     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_SRGB8_ALPHA8GL_RGBA  │    8     │     8      │     8     │     8      │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R16FGL_RED   │   f16    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG16FGL_RG    │   f16    │    f16     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB16FGL_RGB   │   f16    │    f16     │    f16    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA16FGL_RGBA  │   f16    │    f16     │    f16    │    f16     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R32FGL_RED   │   f32    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG32FGL_RG    │   f32    │    f32     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB32FGL_RGB   │   f32    │    f32     │    f32    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA32FGL_RGBA  │   f32    │    f32     │    f32    │    f32     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R11F_G11F_B10FGL_RGB   │   f11    │    f11     │    f10    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB9_E5GL_RGB   │    9     │     9      │     9     │            │      5      │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R8IGL_RED   │    i8    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R8UIGL_RED   │   ui8    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R16IGL_RED   │   i16    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R16UIGL_RED   │   ui16   │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R32IGL_RED   │   i32    │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_R32UIGL_RED   │   ui32   │            │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG8IGL_RG    │    i8    │     i8     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG8UIGL_RG    │   ui8    │    ui8     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG16IGL_RG    │   i16    │    i16     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG16UIGL_RG    │   ui16   │    ui16    │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG32IGL_RG    │   i32    │    i32     │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RG32UIGL_RG    │   ui32   │    ui32    │           │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB8IGL_RGB   │    i8    │     i8     │    i8     │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB8UIGL_RGB   │   ui8    │    ui8     │    ui8    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB16IGL_RGB   │   i16    │    i16     │    i16    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB16UIGL_RGB   │   ui16   │    ui16    │   ui16    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB32IGL_RGB   │   i32    │    i32     │    i32    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGB32UIGL_RGB   │   ui32   │    ui32    │   ui32    │            │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA8IGL_RGBA  │    i8    │     i8     │    i8     │     i8     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA8UIGL_RGBA  │   ui8    │    ui8     │    ui8    │    ui8     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA16IGL_RGBA  │   i16    │    i16     │    i16    │    i16     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA16UIGL_RGBA  │   ui16   │    ui16    │   ui16    │    ui16    │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA32IGL_RGBA  │   i32    │    i32     │    i32    │    i32     │             │
       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼─────────────┤
       │GL_RGBA32UIGL_RGBA  │   ui32   │    ui32    │   ui32    │    ui32    │             │
       └──────────────────┴──────────┴──────────┴────────────┴───────────┴────────────┴─────────────┘

NOTES

       GL_STENCIL_INDEX8 is accepted for internalformat only if the GL version is 4.4 or higher.

ERRORS

       GL_INVALID_OPERATION is generated by glTexStorage2D if zero is bound to target.

       GL_INVALID_OPERATION is generated by glTextureStorage2D if texture is not the name of an
       existing texture object.

       GL_INVALID_ENUM is generated if internalformat is not a valid sized internal format.

       GL_INVALID_ENUM is generated if target or the effective target of texture is not one of
       the accepted targets described above.

       GL_INVALID_VALUE is generated if width, height or levels are less than 1.

       GL_INVALID_OPERATION is generated if target is GL_TEXTURE_1D_ARRAY or
       GL_PROXY_TEXTURE_1D_ARRAY and levels is greater than log 2 width + 1.

       GL_INVALID_OPERATION is generated if target is not GL_TEXTURE_1D_ARRAY or
       GL_PROXY_TEXTURE_1D_ARRAY and levels is greater than log 2 max width ,   height + 1.

VERSION SUPPORT

       ┌───────────────────┬───────────────────────────────────────────────────────────────────────┐
       │                   │                OpenGL Version                                         │
       ├───────────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
       │Function2.02.13.03.13.23.34.04.14.24.34.44.5 │
       │/                  │     │     │     │     │     │     │     │     │     │     │     │     │
       │Feature            │     │     │     │     │     │     │     │     │     │     │     │     │
       │Name               │     │     │     │     │     │     │     │     │     │     │     │     │
       ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │glTexStorage2D     │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  ✔  │  ✔  │  ✔  │  ✔  │
       ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │glTextureStorage2D │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  ✔  │
       └───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

SEE ALSO

       glTexImage2D(), glTexStorage1D(), 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

       Copyright © 2011-2014 Khronos Group

[FIXME: source]                             07/22/2015                         GLTEXSTORAGE2D(3G)