GLGETINTERNALFORMAT

Section: [FIXME: manual] (3G)
Updated: 01/26/2021
Page Index
 

NAME

glGetInternalformat - retrieve information about implementation-dependent support for internal formats  

C SPECIFICATION

void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
 

PARAMETERS

target

Indicates the usage of the internal format. target must be GL_TEXTURE_1D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_RECTANGLE, GL_TEXTURE_BUFFER, GL_RENDERBUFFER, GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY.

internalformat

Specifies the internal format about which to retrieve information.

pname

Specifies the type of information to query.

bufSize

Specifies the maximum number of integers of the specified width that may be written to params by the function.

params

Specifies the address of a variable into which to write the retrieved information.
 

DESCRIPTION

glGetInternalformativ and glGetInternalformati64v retrieve information about implementation-dependent support for internal formats. target indicates the target with which the internal format will be used and must be one of GL_RENDERBUFFER, GL_TEXTURE_2D_MULTISAMPLE, or GL_TEXTURE_2D_MULTISAMPLE_ARRAY, corresponding to usage as a renderbuffer, two-dimensional multisample texture or two-dimensional multisample array texture, respectively.

internalformat specifies the internal format about which to retrieve information and must be a color-renderable, depth-renderable or stencil-renderable format.

The information retrieved will be written to memory addressed by the pointer specified in params. No more than bufSize integers will be written to this memory.

If pname is GL_NUM_SAMPLE_COUNTS, the number of sample counts that would be returned by querying GL_SAMPLES will be returned in params.

If pname is GL_SAMPLES, the sample counts supported for internalformat and target are written into params in descending numeric order. Only positive values are returned. Querying GL_SAMPLES with bufSize of one will return just the maximum supported number of samples for this format. The maximum value in GL_SAMPLES is guaranteed to be at least the lowest of the following:

• The value of GL_MAX_INTEGER_SAMPLES if internalformat is a signed or unsigned integer format.

• The value of GL_MAX_DEPTH_TEXTURE_SAMPLES if internalformat is a depth- or stencil-renderable format and target is GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_2D_MULTISAMPLE_ARRAY.

• The value of GL_MAX_COLOR_TEXTURE_SAMPLES if internalformat is a color-renderable format and target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY.

• The value of GL_MAX_SAMPLES.

If pname is GL_INTERNALFORMAT_SUPPORTED, params is set to GL_TRUE if internalformat is a supported internal format for target and to GL_FALSE otherwise.

If pname is GL_INTERNALFORMAT_PREFERRED, params is set to GL_TRUE if internalformat is an format for target that is preferred by the implementation and to GL_FALSE otherwise.

If pname is GL_INTERNALFORMAT_RED_SIZE, GL_INTERNALFORMAT_GREEN_SIZE, GL_INTERNALFORMAT_BLUE_SIZE, GL_INTERNALFORMAT_ALPHA_SIZE, GL_INTERNALFORMAT_DEPTH_SIZE, GL_INTERNALFORMAT_STENCIL_SIZE, or GL_INTERNALFORMAT_SHARED_SIZE then params is set to the actual resolutions that would be used for storing image array components for the resource for the red, green, blue, alpha, depth, stencil and shared channels respectively. If internalformat is a compressed internal format, then params is set to the component resolution of an uncompressed internal format that produces an image of roughly the same quality as the compressed algorithm. If the internal format is unsupported, or if a particular component is not present in the format, 0 is written to params.

If pname is GL_INTERNALFORMAT_RED_TYPE, GL_INTERNALFORMAT_GREEN_TYPE, GL_INTERNALFORMAT_BLUE_TYPE, GL_INTERNALFORMAT_ALPHA_TYPE, GL_INTERNALFORMAT_DEPTH_TYPE, or GL_INTERNALFORMAT_STENCIL_TYPE then params is set to a token identifying the data type used to store the respective component. If the internalformat represents a compressed internal format then the types returned specify how components are interpreted after decompression.

If pname is GL_MAX_WIDTH, GL_MAX_HEIGHT, GL_MAX_DEPTH, or GL_MAX_LAYERS then pname is filled with the maximum width, height, depth or layer count for textures with internal format internalformat, respectively. If pname is GL_MAX_COMBINED_DIMENSIONS then pname is filled with the maximum combined dimensions of a texture of the specified internal format.

If pname is GL_COLOR_COMPONENTS then params is set to the value GL_TRUE if the internal format contains any color component (i.e., red, green, blue or alpha) and to GL_FALSE otherwise. If pname is GL_DEPTH_COMPONENTS or GL_STENCIL_COMPONENTS then params is set to GL_TRUE if the internal format contains a depth or stencil component, respectively, and to GL_FALSE otherwise.

If pname is GL_COLOR_RENDERABLE, GL_DEPTH_RENDERABLE or GL_STENCIL_RENDERABLE then params is set to GL_TRUE if the specified internal format is color, depth or stencil renderable, respectively, and to GL_FALSE otherwise.

If pname is GL_FRAMEBUFFER_RENDERABLE or GL_FRAMEBUFFER_RENDERABLE_LAYERED then params is set to one of GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT or GL_NONE to indicate that framebuffer attachments (layered attachments in the case of GL_FRAMEBUFFER_RENDERABLE_LAYERED) with that internal format are either renderable with no restrictions, renderable with some restrictions or not renderable at all.

If pname is GL_FRAMEBUFFER_BLEND, params is set to GL_TRUE to indicate that the internal format is supported for blending operations when attached to a framebuffer, and to GL_FALSE otherwise.

If pname is GL_READ_PIXELS then params is set to GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT or GL_NONE to that either full support, limited support or no support at all is supplied for reading pixels from framebuffer attachments in the specified internal format.

If pname is GL_READ_PIXELS_FORMAT or GL_READ_PIXELS_TYPE then params is filled with the format or type, respectively, most recommended to obtain the highest image quality and performance. For GL_READ_PIXELS_FORMAT, the value returned in params is a token that is accepted for the format argument to glReadPixels(). For GL_READ_PIXELS_TYPE, the value returned in params is a token that is accepted for the type argument to glReadPixels().

If pname is GL_TEXTURE_IMAGE_FORMAT or GL_TEXTURE_IMAGE_TYPE then params is filled with the implementation-recommended format or type to be used in calls to glTexImage2D() and other similar functions. For GL_TEXTURE_IMAGE_FORMAT, params is filled with a token suitable for use as the format argument to glTexImage2D(). For GL_TEXTURE_IMAGE_TYPE, params is filled with a token suitable for use as the type argument to glTexImage2D().

If pname is GL_GET_TEXTURE_IMAGE_FORMAT or GL_GET_TEXTURE_IMAGE_TYPE then params is filled with the implementation-recommended format or type to be used in calls to glGetTexImage() and other similar functions. For GL_GET_TEXTURE_IMAGE_FORMAT, params is filled with a token suitable for use as the format argument to glGetTexImage(). For GL_GET_TEXTURE_IMAGE_TYPE, params is filled with a token suitable for use as the type argument to glGetTexImage().

If pname is GL_MIPMAP then pname is set to GL_TRUE to indicate that the specified internal format supports mipmaps and to GL_FALSE otherwise.

If pname is GL_GENERATE_MIPMAP or GL_AUTO_GENERATE_MIPMAP then params is indicates the level of support for manual or automatic mipmap generation for the specified internal format, respectively. Returned values may be one of GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT and GL_NONE to indicate either full support, limited support or no support at all.

If pname is GL_COLOR_ENCODING then the color encoding for the resource is returned in params. Possible values for color buffers are GL_LINEAR or GL_SRGB, for linear or sRGB-encoded color components, respectively. For non-color formats (such as depth or stencil), or for unsupported resources, the value GL_NONE is returned.

If pname is GL_SRGB_READ, or GL_SRGB_WRITE then params indicates the level of support for reading and writing to sRGB encoded images, respectively. For GL_SRGB_READ, support for converting from sRGB colorspace on read operations is returned in params and for GL_SRGB_WRITE, support for converting to sRGB colorspace on write operations to the resource is returned in params. params may be set to GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT, or GL_NONE to indicate full support, limited support or no support at all, respecitively.

If pname is GL_FILTER the params is set to either GL_TRUE or GL_FALSE to indicate support or lack thereof for filter modes other than GL_NEAREST or GL_NEAREST_MIPMAP for the specified internal format.

If pname is GL_VERTEX_TEXTURE, GL_TESS_CONTROL_TEXTURE, GL_TESS_EVALUATION_TEXTURE, GL_GEOMETRY_TEXTURE, GL_FRAGMENT_TEXTURE, or GL_COMPUTE_TEXTURE, then the value written to params indicates support for use of the resource as a source of texturing in the vertex, tessellation control, tessellation evaluation, geometry, fragment and compute shader stages, respectively. params may be set to GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT or GL_NONE to indicate full support, limited support or no support at all, respectively.

If pname is GL_TEXTURE_SHADOW, GL_TEXTURE_GATHER or GL_TEXTURE_GATHER_SHADOW then the value written to params indicates the level of support for using the resource with a shadow sampler, in gather operations or as a shadow sampler in gather operations, respectively. Returned values may be GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT or GL_NONE to indicate full support, limited support or no support at all, respectively.

If pname is GL_SHADER_IMAGE_LOAD, GL_SHADER_IMAGE_STORE or GL_SHADER_IMAGE_ATOMIC then the value returned in params indicates the level of support for image loads, stores and atomics for resources of the specified internal format. Returned values may be GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT or GL_NONE to indicate full support, limited support or no support at all, respectively.

If pname is GL_IMAGE_TEXEL_SIZE then the size of a texel when the resource when used as an image texture is returned in params. If the resource is not supported for image textures zero is returned.

If pname is GL_IMAGE_COMPATIBILITY_CLASS then the compatibility class of the resource when used as an image texture is returned in params. The possible values returned are GL_IMAGE_CLASS_4_X_32, GL_IMAGE_CLASS_2_X_32, GL_IMAGE_CLASS_1_X_32, GL_IMAGE_CLASS_4_X_16, GL_IMAGE_CLASS_2_X_16, GL_IMAGE_CLASS_1_X_16, GL_IMAGE_CLASS_4_X_8, GL_IMAGE_CLASS_2_X_8, GL_IMAGE_CLASS_1_X_8, GL_IMAGE_CLASS_11_11_10, and GL_IMAGE_CLASS_10_10_10_2, which correspond to the 4x32, 2x32, 1x32, 4x16, 2x16, 1x16, 4x8, 2x8, 1x8, the class (a) 11/11/10 packed floating-point format, and the class (b) 10/10/10/2 packed formats, respectively. If the resource is not supported for image textures, GL_NONE is returned.

If pname is GL_IMAGE_PIXEL_FORMAT or GL_IMAGE_PIXEL_TYPE then the pixel format or type of the resource when used as an image texture is returned in params, respectively. In either case, the resource is not supported for image textures GL_NONE is returned.

If pname is GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, the matching criteria use for the resource when used as an image textures is returned in params. Possible values returned in params are GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE or GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS. If the resource is not supported for image textures, GL_NONE is returned.

If pname is GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST or GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST, support for using the resource both as a source for texture sampling while it is bound as a buffer for depth or stencil test, respectively, is written to params. Possible values returned are GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT, or GL_NONE to indicate full support, limited support or no support at all. If the resource or operation is not supported, GL_NONE is returned.

If pname is GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE or GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE, support for using the resource both as a source for texture sampling while performing depth or stencil writes to the resources, respectively, is written to params. Possible values returned are GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT, or GL_NONE to indicate full support, limited support or no support at all. If the resource or operation is not supported, GL_NONE is returned.

If pname is GL_TEXTURE_COMPRESSED then GL_TRUE is returned in params if internalformat is a compressed internal format. GL_FALSE is returned in params otherwise.

If pname is GL_TEXTURE_COMPRESSED_BLOCK_WIDTH, GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT or GL_TEXTURE_COMPRESSED_BLOCK_SIZE then the width, height or total size, respectively of a block (in basic machine units) is returned in params. If the internal format is not compressed, or the resource is not supported, 0 is returned.

If pname is GL_CLEAR_BUFFER, the level of support for using the resource with glClearBufferData() and glClearBufferSubData() is returned in params. Possible values returned are GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT, or GL_NONE to indicate full support, limited support or no support at all, respectively. If the resource or operation is not supported, GL_NONE is returned.

If pname is GL_TEXTURE_VIEW, the level of support for using the resource with the glTextureView() command is returned in params. Possible values returned are GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT, or GL_NONE to indicate full support, limited support or no support at all, respectively. If the resource or operation is not supported, GL_NONE is returned.

If pname is GL_VIEW_COMPATIBILITY_CLASS then the compatibility class of the resource when used as a texture view is returned in params. The possible values returned are GL_VIEW_CLASS_128_BITS, GL_VIEW_CLASS_96_BITS, GL_VIEW_CLASS_64_BITS, GL_VIEW_CLASS_48_BITS, GL_VIEW_CLASS_32_BITS, GL_VIEW_CLASS_24_BITS, GL_VIEW_CLASS_16_BITS, GL_VIEW_CLASS_8_BITS, GL_VIEW_CLASS_S3TC_DXT1_RGB, GL_VIEW_CLASS_S3TC_DXT1_RGBA, GL_VIEW_CLASS_S3TC_DXT3_RGBA, GL_VIEW_CLASS_S3TC_DXT5_RGBA, GL_VIEW_CLASS_RGTC1_RED, GL_VIEW_CLASS_RGTC2_RG, GL_VIEW_CLASS_BPTC_UNORM, and GL_VIEW_CLASS_BPTC_FLOAT.

If pname is GL_CLEAR_TEXTURE then the presence of support for using the glClearTexImage() and glClearTexSubImage() commands with the resource is written to params. Possible values written are GL_FULL_SUPPORT, GL_CAVEAT_SUPPORT, or GL_NONE to indicate full support, limited support or no support at all, respectively. If the resource or operation is not supported, GL_NONE is returned.  

NOTES

glGetInternalformativ is available only if the GL version is 4.2 or higher.

The tokens GL_INTERNALFORMAT_SUPPORTED, GL_INTERNALFORMAT_PREFERRED, GL_INTERNALFORMAT_RED_SIZE, GL_INTERNALFORMAT_GREEN_SIZE, GL_INTERNALFORMAT_BLUE_SIZE, GL_INTERNALFORMAT_ALPHA_SIZE, GL_INTERNALFORMAT_DEPTH_SIZE, GL_INTERNALFORMAT_STENCIL_SIZE, GL_INTERNALFORMAT_SHARED_SIZE, GL_INTERNALFORMAT_RED_TYPE, GL_INTERNALFORMAT_GREEN_TYPE, GL_INTERNALFORMAT_BLUE_TYPE, GL_INTERNALFORMAT_ALPHA_TYPE, GL_INTERNALFORMAT_DEPTH_TYPE, GL_INTERNALFORMAT_STENCIL_TYPE, GL_MAX_WIDTH, GL_MAX_HEIGHT, GL_MAX_DEPTH, GL_MAX_LAYERS, GL_MAX_COMBINED_DIMENSIONS, GL_COLOR_COMPONENTS, GL_DEPTH_COMPONENTS, GL_STENCIL_COMPONENTS, GL_COLOR_RENDERABLE, GL_DEPTH_RENDERABLE, GL_STENCIL_RENDERABLE, GL_FRAMEBUFFER_RENDERABLE, GL_FRAMEBUFFER_RENDERABLE_LAYERED, GL_FRAMEBUFFER_BLEND, GL_READ_PIXELS, GL_READ_PIXELS_FORMAT, GL_READ_PIXELS_TYPE, GL_TEXTURE_IMAGE_FORMAT, GL_TEXTURE_IMAGE_TYPE, GL_GET_TEXTURE_IMAGE_FORMAT, GL_GET_TEXTURE_IMAGE_TYPE, GL_MIPMAP, GL_GENERATE_MIPMAP, GL_AUTO_GENERATE_MIPMAP, GL_COLOR_ENCODING, GL_SRGB_READ, GL_SRGB_WRITE, GL_SRGB_DECODE_ARB, GL_FILTER, GL_VERTEX_TEXTURE, GL_TESS_CONTROL_TEXTURE, GL_TESS_EVALUATION_TEXTURE, GL_GEOMETRY_TEXTURE, GL_FRAGMENT_TEXTURE, GL_COMPUTE_TEXTURE, GL_TEXTURE_SHADOW, GL_TEXTURE_GATHER, GL_TEXTURE_GATHER_SHADOW, GL_SHADER_IMAGE_LOAD, GL_SHADER_IMAGE_STORE, GL_SHADER_IMAGE_ATOMIC, GL_IMAGE_TEXEL_SIZE, GL_IMAGE_COMPATIBILITY_CLASS, GL_IMAGE_PIXEL_FORMAT, GL_IMAGE_PIXEL_TYPE, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST, GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST, GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE, GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE, GL_TEXTURE_COMPRESSED, GL_TEXTURE_COMPRESSED_BLOCK_WIDTH, GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT, GL_TEXTURE_COMPRESSED_BLOCK_SIZE, GL_CLEAR_BUFFER, GL_TEXTURE_VIEW, and GL_VIEW_COMPATIBILITY_CLASS are supported only if the GL version is 4.3 or higher.

The GL_CLEAR_TEXTURE token is accepted for pname only if the GL version is 4.4 or higher.  

ERRORS

GL_INVALID_VALUE is generated if bufSize is negative.

GL_INVALID_ENUM is generated if pname is not GL_SAMPLES or GL_NUM_SAMPLE_COUNTS.

GL_INVALID_ENUM is generated if internalformat is not color-, depth-, or stencil-renderable.

GL_INVALID_ENUM is generated if target is not one of GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_2D_MULTISAMPLE_ARRAY or GL_RENDERBUFFER.  

VERSION SUPPORT

OpenGL Version
Function / Feature Name 2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5
glGetInternalformati64v - - - - - - - - -
glGetInternalformativ - - - - - - - -

 

SEE ALSO

glGet()  

COPYRIGHT

Copyright © 2011-2018 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. m[blue]http://opencontent.org/openpub/m[].  

COPYRIGHT


Copyright © 2011-2014 Khronos Group.


 

Index

NAME
C SPECIFICATION
PARAMETERS
DESCRIPTION
NOTES
ERRORS
VERSION SUPPORT
SEE ALSO
COPYRIGHT
COPYRIGHT