Texture objects are fundamental to the operation of OpenGL. They are used as a source for texture sampling and destination for rendering as well as
being accessed in shaders for image load/store operations. It is also possible to invalidate the contents of a texture. It is currently only possible to
set texture image data to known values by uploading some or all of a image array from application memory or by attaching it to a framebuffer object and
using Clear or the OpenGL 3. ClearBuffer commands.
Both uploading initial texture data and clearing by attaching to a framebuffer have potential disadvantages when one simply wants to initialize texture data to a known value. Uploading initial data requires the application to allocate a (potentially large) chunk of memory and transferring that to the GL. This can be a costly operation both in terms of memory bandwidth and power usage. Alternatively, attaching a texture level to a framebuffer to clear it may not be possible if the texture format isn't supported for rendering, or even if it is, attaching the image to a framebuffer object may cause the texture to be allocated in certain types of memory, which it may otherwise not need to be placed in.
This extension solves these problems by providing a mechanism whereby the contents of a texture image array can be set to known values by using the
ClearTexImage or ClearTexSubImage commands. These commands can also be useful for initializing an image that will be used for atomic shader
operations.
Requires OpenGL 1.. Promoted to core in OpenGL 4..
| Modifier and Type | Field and Description |
|---|---|
| public static final int | GL_CLEAR_TEXTURE
Accepted by the |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static void | glClearTexImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int format, int the type of the source data. One of: type, ByteBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Is equivalent to calling |
| public static void | glClearTexImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int format, int the type of the source data. One of: type, ShortBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Is equivalent to calling |
| public static void | glClearTexImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int format, int the type of the source data. One of: type, IntBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Is equivalent to calling |
| public static void | glClearTexImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int format, int the type of the source data. One of: type, FloatBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Is equivalent to calling |
| public static void | glClearTexImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int format, int the type of the source data. One of: type, DoubleBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Is equivalent to calling |
| public static void | glClearTexImage(int texture, int level, int format, int type, short[] data)
Array version of: |
| public static void | glClearTexImage(int texture, int level, int format, int type, int[] data)
Array version of: |
| public static void | glClearTexImage(int texture, int level, int format, int type, float[] data)
Array version of: |
| public static void | glClearTexImage(int texture, int level, int format, int type, double[] data)
Array version of: |
| public static void | glClearTexSubImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int the x coordinate of the texel subregion xoffset, int the y coordinate of the texel subregion yoffset, int the z coordinate of the texel subregion zoffset, int the subregion width width, int the subregion height height, int the subregion depth depth, int format, int the type of the source data. One of: type, ByteBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Fills all or part of a texture image with a constant value. |
| public static void | glClearTexSubImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int the x coordinate of the texel subregion xoffset, int the y coordinate of the texel subregion yoffset, int the z coordinate of the texel subregion zoffset, int the subregion width width, int the subregion height height, int the subregion depth depth, int format, int the type of the source data. One of: type, ShortBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Fills all or part of a texture image with a constant value. |
| public static void | glClearTexSubImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int the x coordinate of the texel subregion xoffset, int the y coordinate of the texel subregion yoffset, int the z coordinate of the texel subregion zoffset, int the subregion width width, int the subregion height height, int the subregion depth depth, int format, int the type of the source data. One of: type, IntBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Fills all or part of a texture image with a constant value. |
| public static void | glClearTexSubImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int the x coordinate of the texel subregion xoffset, int the y coordinate of the texel subregion yoffset, int the z coordinate of the texel subregion zoffset, int the subregion width width, int the subregion height height, int the subregion depth depth, int format, int the type of the source data. One of: type, FloatBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Fills all or part of a texture image with a constant value. |
| public static void | glClearTexSubImage(int
the texture to clear. It is an error if texture, int texture is zero or not the name of a texture object, if texture is a buffer texture, or if
the texture image has a compressed internal formatthe texture level to clear level, int the x coordinate of the texel subregion xoffset, int the y coordinate of the texel subregion yoffset, int the z coordinate of the texel subregion zoffset, int the subregion width width, int the subregion height height, int the subregion depth depth, int format, int the type of the source data. One of: type, DoubleBuffer an array of between one and four components of texel data that will be used as the source for the constant fill value. If data)data is NULL,
then the pointer is ignored and the sub-range of the texture image is filled with zeros.Fills all or part of a texture image with a constant value. |
| public static void | glClearTexSubImage(int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, short[] data)
Array version of: |
| public static void | glClearTexSubImage(int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, int[] data)
Array version of: |
| public static void | glClearTexSubImage(int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, float[] data)
Array version of: |
| public static void | glClearTexSubImage(int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, double[] data)
Array version of: |
| public static void | nglClearTexImage(int texture, int level, int format, int type, long data)
Unsafe version of: |
| public static void | nglClearTexSubImage(int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, long data)
Unsafe version of: |