GLTEXSTORAGE2D(3G)

    .SH "NAME" glTexStorage2D - simultaneously specify storage for all levels of a two-dimensional texture
    .SH "C SPECIFICATION"

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

    .SH "PARAMETERS"

        .PP target

                    Specify the target of the operation. target must be one of GL_TEXTURE_2D, or GL_TEXTURE_CUBE_MAP.

            .RE
            .PP levels

                        Specify the number of texture levels.

                .RE
                .PP internalformat

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

                    .RE
                    .PP width

                                Specifies the width of the texture, in texels.

                        .RE
                        .PP height

                                    Specifies the height of the texture, in texels.

                            .RE

                        .SH "DESCRIPTION"
                            .PP glTexStorage2D specifies the storage requirements for all levels of a two-dimensional texture simultaneously. Once a texture is specified with this command, the format and dimensions of all levels become immutable. 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.
                            .PP The behavior of glTexStorage2D depends on the target parameter. When target is GL_TEXTURE_2D, 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));
                            }

                            .PP 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));
                            }

                            .PP 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, or one of the compressed internal formats given in Table 2 below. 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.
                            .PP <xi:include></xi:include>
                            .PP <xi:include></xi:include>

                        .SH "ERRORS"
                            .PP GL_INVALID_OPERATION is generated if the default texture object is curently bound to target.
                            .PP GL_INVALID_OPERATION is generated if the texture object curently bound to target already has GL_TEXTURE_IMMUTABLE_FORMAT set to GL_TRUE.
                            .PP GL_INVALID_ENUM is generated if internalformat is not a valid sized internal format.
                            .PP GL_INVALID_ENUM is generated if target is not one of the accepted target enumerants.
                            .PP GL_INVALID_VALUE is generated if width, height or levels are less than 1.
                            .PP GL_INVALID_OPERATION is generated if levels is greater than log 2 max width , height + 1.

                        .SH "API VERSION SUPPORT"

                            .TS allbox tab(:); l l l l l. T{ glTexStorage2D T}:T{ T}:T{ T}:T{ T}:T{ T}

                        .SH "SEE ALSO"
                            .PP glTexImage2D(), glCompressedTexImage2D(), glTexStorage3D().

                        .SH "COPYRIGHT"
                            .PP Copyright © 2011-2015 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-2015 Khronos Group