OooglesOoogles Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers License |
record TGLTexture
Unit
Neslib.Ooogles
Declaration
type TGLTexture = record
Description
A texture
Overview
Methods
procedure New(const AType: TGLTextureType = TGLTextureType.TwoD); inline; |
procedure Delete; inline; |
procedure Bind; inline; |
procedure Unbind; inline; |
function IsBound: Boolean; inline; |
procedure BindToTextureUnit(const ATextureUnit: Cardinal); inline; |
procedure UnbindFromTextureUnit(const ATextureUnit: Cardinal); inline; |
procedure GenerateMipmap; inline; |
procedure MinFilter(const AMinFilter: TGLMinFilter); inline; |
function GetMinFilter: TGLMinFilter; inline; |
procedure MagFilter(const AMagFilter: TGLMagFilter); inline; |
function GetMagFilter: TGLMagFilter; inline; |
procedure WrapS(const AWrap: TGLWrapMode); inline; |
function GetWrapS: TGLWrapMode; inline; |
procedure WrapT(const AWrap: TGLWrapMode); inline; |
function GetWrapT: TGLWrapMode; inline; |
procedure Upload(const AFormat: TGLPixelFormat; const AWidth, AHeight: Integer; const AData: Pointer; const ALevel: Integer = 0; const AType: TGLPixelDataType = TGLPixelDataType.UnsignedByte; const ACubeTarget: TGLCubeTarget = 0); inline; |
procedure SubUpload(const AFormat: TGLPixelFormat; const AXOffset, AYOffset, AWidth, AHeight: Integer; const AData: Pointer; const ALevel: Integer = 0; const AType: TGLPixelDataType = TGLPixelDataType.UnsignedByte; const ACubeTarget: TGLCubeTarget = 0); inline; |
procedure UploadCompressed(const AFormat: Cardinal; const AWidth, AHeight: Integer; const AData: Pointer; const ADataSize: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
procedure SubUploadCompressed(const AFormat: Cardinal; const AXOffset, AYOffset, AWidth, AHeight: Integer; const AData: Pointer; const ADataSize: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
procedure Copy(const AFormat: TGLPixelFormat; const ALeft, ABottom, AWidth, AHeight: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
procedure SubCopy(const AXOffset, AYOffset, ALeft, ABottom, AWidth, AHeight: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
class function GetCurrent2DTexture: TGLTexture; inline; static; |
class function GetCurrentCubemapTexture: TGLTexture; inline; static; |
class function GetActiveTextureUnit: Integer; inline; static; |
class function GetCompressedTextureFormats: TArray<Cardinal>; inline; static; |
class procedure MipmapHint(const AHint: TGLMipmapHint); inline; static; |
class function GetMipmapHint: TGLMipmapHint; inline; static; |
class function GetMaxTextureUnits: Integer; inline; static; |
class function GetMaxCombinedTextureUnits: Integer; inline; static; |
class function GetMaxVertexTextureUnits: Integer; inline; static; |
class function GetMaxTextureSize: Integer; inline; static; |
class function GetMaxCubeMapTextureSize: Integer; inline; static; |
Properties
property Handle: GLuint read FHandle; |
Description
Methods
procedure New(const AType: TGLTextureType = TGLTextureType.TwoD); inline; |
Creates a texture.
OpenGL API: glGenTextures
Parameters
- AType
- (optional) type of texture to create. Defaults to a 2D texture.
See also
- Bind
- Binds the texture.
- Delete
- Deletes the texture.
- Upload
- Uploads an image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
|
procedure Delete; inline; |
Deletes the texture.
After a texture is deleted, it has no contents or dimensionality. If a texture that is currently bound is deleted, the binding reverts to 0 (the default texture).
OpenGL API: glDeleteTextures
See also
- Bind
- Binds the texture.
- New
- Creates a texture.
|
procedure Bind; inline; |
Binds the texture.
Lets you create or use a named texture. Binds the texture name to the target of the current active texture unit. When a texture is bound to a target, the previous binding for that target is automatically broken.
When a texture is first bound, it assumes the specified target: A first bound texture of type TGLTextureType.TwoD becomes a two-dimensional texture and a first bound texture of type TGLTextureType.CubeMap becomes a cube-mapped texture. The state of a two-dimensional texture immediately after it is first bound is equivalent to the state of the default texture at GL initialization.
While a texture is bound, GL operations on the target to which it is bound affect the bound texture, and queries of the target to which it is bound return state from the bound texture. In effect, the texture targets become aliases for the textures currently bound to them, and the texture name zero refers to the default textures that were bound to them at initialization.
A texture binding remains active until a different texture is bound to the same target, or until the bound texture is deleted with Delete.
Once created, a named texture may be re-bound to its same original target as often as needed. It is usually much faster to use Bind to bind an existing named texture to one of the texture targets than it is to reload the texture image using Upload.
OpenGL API: glBindTexture
See also
- New
- Creates a texture.
- Delete
- Deletes the texture.
- Unbind
- Unbinds the texture.
- IsBound
- Checks if this texture is currently bound.
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- UnbindFromTextureUnit
- Actives a texture unit and unbinds this texture from that unit.
|
procedure Unbind; inline; |
Unbinds the texture.
OpenGL API: glBindTexture
See also
- Bind
- Binds the texture.
- IsBound
- Checks if this texture is currently bound.
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- UnbindFromTextureUnit
- Actives a texture unit and unbinds this texture from that unit.
|
function IsBound: Boolean; inline; |
Checks if this texture is currently bound.
Returns
True if this is the currently bound texture, False otherwise. |
procedure BindToTextureUnit(const ATextureUnit: Cardinal); inline; |
Actives a texture unit and binds this texture to that unit.
Once the texture unit is active, it binds the texture by calling Bind.
OpenGL API: glActiveTexture, glBindTexture
Parameters
- ATextureUnit
- index of the texture unit to make active. The number of texture units is implementation dependent, but must be at least 8.
Exceptions raised
TGLError.InvalidEnum
- if ATextureUnit is greater than the number of supported texture units.
See also
- Bind
- Binds the texture.
- Unbind
- Unbinds the texture.
- IsBound
- Checks if this texture is currently bound.
- UnbindFromTextureUnit
- Actives a texture unit and unbinds this texture from that unit.
- GetMaxTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the fragment shader.
- GetMaxCombinedTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined.
|
procedure UnbindFromTextureUnit(const ATextureUnit: Cardinal); inline; |
Actives a texture unit and unbinds this texture from that unit.
Once the texture unit is active, it unbinds the texture by calling Unbind.
OpenGL API: glActiveTexture, glBindTexture
Parameters
- ATextureUnit
- index of the texture unit to make active. The number of texture units is implementation dependent, but must be at least 8.
Exceptions raised
TGLError.InvalidEnum
- if ATextureUnit is greater than the number of supported texture units.
See also
- Bind
- Binds the texture.
- Unbind
- Unbinds the texture.
- IsBound
- Checks if this texture is currently bound.
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- GetMaxTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the fragment shader.
- GetMaxCombinedTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined.
|
procedure GenerateMipmap; inline; |
Generate a complete set of mipmaps for this texture object.
Computes a complete set of mipmap arrays derived from the zero level array. Array levels up to and including the 1x1 dimension texture image are replaced with the derived arrays, regardless of previous contents. The zero level texture image is left unchanged.
The internal formats of the derived mipmap arrays all match those of the zero level texture image. The dimensions of the derived arrays are computed by halving the width and height of the zero level texture image, then in turn halving the dimensions of each array level until the 1x1 dimension texture image is reached.
The contents of the derived arrays are computed by repeated filtered reduction of the zero level array. No particular filter algorithm is required, though a box filter is recommended. MipmapHint may be called to express a preference for speed or quality of filtering.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glGenerateMipmap
Exceptions raised
TGLError.InvalidOperation
- if this is a cube map texture, but its six faces do not share indentical widths, heights, formats, and types.
TGLError.InvalidOperation
- if either the width or height of the zero level array is not a power of two.
TGLError.InvalidOperation
- if the zero level array is stored in a compressed internal format.
See also
- Bind
- Binds the texture.
- Unbind
- Unbinds the texture.
- TGLFrameBuffer.AttachTexture
- Attach a texture to this framebuffer.
- MipmapHint
- Sets an implementation-specific hint for generating mipmaps.
- Upload
- Uploads an image to the texture.
|
procedure MinFilter(const AMinFilter: TGLMinFilter); inline; |
Sets the minification filter for this texture.
The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps.
A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions W × H, there are Floor(Log2(Max(W, H)) + 1) mipmap levels. The first mipmap level is the original texture, with dimensions W × H. Each subsequent mipmap level has half the dimensions of the previous level, until the final mipmap is reached, which has dimension 1 × 1.
To define the mipmap levels, call Upload, UploadCompressed or Copy with the ALevel argument indicating the order of the mipmaps. Level 0 is the original texture; level Floor(Log2(Max(W, H))) is the final 1 × 1 mipmap.
As more texture elements are sampled in the minification process, fewer aliasing artifacts will be apparent. While the Nearest and Linear minification functions can be faster than the other four, they sample only one or four texture elements to determine the texture value of the pixel being rendered and can produce moire patterns or ragged transitions. The initial value of the minification filter is NearestMipmapLinear.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glTexParameteri(GL_TEXTURE_MIN_FILTER)
Parameters
- AMinFilter
- the minification filter.
See also
- Bind
- Binds the texture.
- Unbind
- Unbinds the texture.
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- UnbindFromTextureUnit
- Actives a texture unit and unbinds this texture from that unit.
- Upload
- Uploads an image to the texture.
- SubUpload
- Uploads a part of an image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
- SubCopy
- Copies pixels from a part of the current framebuffer into the texture.
- gl.PixelStore
- Set pixel storage alignment.
- GetMinFilter
- Gets the minification filter for this texture.
- MagFilter
- Sets the magnification filter for this texture.
|
function GetMinFilter: TGLMinFilter; inline; |
Gets the minification filter for this texture.
OpenGL API: glGetTexParameteriv(GL_TEXTURE_MIN_FILTER)
Returns
The minification filter. See also
- MinFilter
- Sets the minification filter for this texture.
|
procedure MagFilter(const AMagFilter: TGLMagFilter); inline; |
Sets the magnification filter for this texture.
The texture magnification function is used when the pixel being textured maps to an area less than or equal to one texture element. It sets the texture magnification function to either Nearest or Linear. Nearest is generally faster than Linear, but it can produce textured images with sharper edges because the transition between texture elements is not as smooth. The initial value of the magnification filter is Linear.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glTexParameteri(GL_TEXTURE_MAG_FILTER)
Parameters
- AMagFilter
- the magnification filter.
See also
- Bind
- Binds the texture.
- Unbind
- Unbinds the texture.
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- UnbindFromTextureUnit
- Actives a texture unit and unbinds this texture from that unit.
- Upload
- Uploads an image to the texture.
- SubUpload
- Uploads a part of an image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
- SubCopy
- Copies pixels from a part of the current framebuffer into the texture.
- gl.PixelStore
- Set pixel storage alignment.
- GetMagFilter
- Gets the magnification filter for this texture.
- MinFilter
- Sets the minification filter for this texture.
|
function GetMagFilter: TGLMagFilter; inline; |
Gets the magnification filter for this texture.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glGetTexParameteriv(GL_TEXTURE_MAG_FILTER)
Returns
The magnification filter. See also
- MagFilter
- Sets the magnification filter for this texture.
|
procedure WrapS(const AWrap: TGLWrapMode); inline; |
Sets the wrap mode for texture coordinate S (horizontal).
See TGLWrapMode for options and their effects.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glTexParameteri(GL_TEXTURE_WRAP_S)
Parameters
- AWrap
- the wrap mode.
See also
- Bind
- Binds the texture.
- Unbind
- Unbinds the texture.
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- UnbindFromTextureUnit
- Actives a texture unit and unbinds this texture from that unit.
- GetWrapS
- Gets the wrap mode for texture coordinate S.
- WrapT
- Sets the wrap mode for texture coordinate T (vertical).
|
function GetWrapS: TGLWrapMode; inline; |
Gets the wrap mode for texture coordinate S.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glGetTexParameteriv(GL_TEXTURE_WRAP_S)
Returns
The wrap mode. See also
- WrapS
- Sets the wrap mode for texture coordinate S (horizontal).
|
procedure WrapT(const AWrap: TGLWrapMode); inline; |
Sets the wrap mode for texture coordinate T (vertical).
See TGLWrapMode for options and their effects.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glTexParameteri(GL_TEXTURE_WRAP_T)
Parameters
- AWrap
- the wrap mode.
See also
- Bind
- Binds the texture.
- Unbind
- Unbinds the texture.
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- UnbindFromTextureUnit
- Actives a texture unit and unbinds this texture from that unit.
- GetWrapT
- Gets the wrap mode for texture coordinate T.
- WrapS
- Sets the wrap mode for texture coordinate S (horizontal).
|
function GetWrapT: TGLWrapMode; inline; |
Gets the wrap mode for texture coordinate T.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glGetTexParameteriv(GL_TEXTURE_WRAP_T)
Returns
The wrap mode. See also
- WrapT
- Sets the wrap mode for texture coordinate T (vertical).
|
procedure Upload(const AFormat: TGLPixelFormat; const AWidth, AHeight: Integer; const AData: Pointer; const ALevel: Integer = 0; const AType: TGLPixelDataType = TGLPixelDataType.UnsignedByte; const ACubeTarget: TGLCubeTarget = 0); inline; |
Uploads an image to the texture. This creates the texture in memory.
Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is active. Texturing is active when the current fragment shader or vertex shader makes use of built-in texture lookup functions.
To define texture images, call Upload . The arguments describe the parameters of the texture image, such as height, width, level-of-detail number (see MinFilter), and format. The other arguments describe how the image is represented in memory.
Data is read from AData as a sequence of unsigned bytes or shorts, depending on AType. Color components are converted to floating point based on the AType.
AWidth × AHeight texels are read from memory, starting at location AData. By default, these texels are taken from adjacent memory locations, except that after all width texels are read, the read pointer is advanced to the next four-byte boundary. The four-byte row alignment is specified by gl.PixelStore with argument UnpackAlignment, and it can be set to one, two, four, or eight bytes.
The first element corresponds to the lower left corner of the texture image. Subsequent elements progress left-to-right through the remaining texels in the lowest row of the texture image, and then in successively higher rows of the texture image. The final element corresponds to the upper right corner of the texture image.
Note: AData may be a nil pointer. In this case, texture memory is allocated to accommodate a texture of AWidth × AHeight pixels. You can then upload subtextures to initialize this texture memory. The image is undefined if the user tries to apply an uninitialized portion of the texture image to a primitive.
Note: This method specifies a two-dimensional or cube-map texture for the current texture unit, specified with BindToTextureUnit.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glTexImage2D
Parameters
- AFormat
- the format of the texel data.
- AWidth
- the width of the texture image. All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide.
- AHeight
- the height of the texture image. All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high.
- AData
- pointer to the image data in memory.
- ALevel
- (optional) level-of-detail number if updating separate mipmap levels. Level 0 (default) is the base image level. Level N is the Nth mipmap reduction image.
- AType
- (optional) data type the texel data. Defaults to UnsignedByte.
- ACubeTarget
- (optional) if this texture is a cube texture, then this parameter specifies which of the 6 cube faces to update. This parameter is ignored for 2D textures.
Exceptions raised
TGLError.InvalidValue
- if this is a cube map texture and the AWidth and
AHeight
- parameters are not equal.
TGLError.InvalidValue
- if ALevel is less than 0 or greater than the maximum level.
TGLError.InvalidValue
- if AWidth or AHeight is less than 0 or greater than the maximum texture size.
TGLError.InvalidOperation
- if AType is UnsignedShort565 and AFormat is not RGB.
TGLError.InvalidOperation
- if AType is UnsignedShort4444 or
UnsignedShort5551
- and AFormat is not RGBA.
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- UploadCompressed
- Uploads a compressed image to the texture.
- SubUpload
- Uploads a part of an image to the texture.
- SubUploadCompressed
- Uploads a part of a compressed image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
- SubCopy
- Copies pixels from a part of the current framebuffer into the texture.
- gl.PixelStore
- Set pixel storage alignment.
- GetMaxTextureSize
- Gets a rough estimate of the largest texture that the GL can handle.
- GetMaxCubeMapTextureSize
- Gets a rough estimate of the largest cube-map texture that the GL can handle.
|
procedure SubUpload(const AFormat: TGLPixelFormat; const AXOffset, AYOffset, AWidth, AHeight: Integer; const AData: Pointer; const ALevel: Integer = 0; const AType: TGLPixelDataType = TGLPixelDataType.UnsignedByte; const ACubeTarget: TGLCubeTarget = 0); inline; |
Uploads a part of an image to the texture. This updates the texture in memory.
This method redefines a contiguous subregion of an existing two-dimensional texture image. The texels referenced by data replace the portion of the existing texture array with X indices AXOffset and AXOffset + AWidth - 1, inclusive, and Y indices AYOffset and AYOffset + AHeight - 1, inclusive. This region may not include any texels outside the range of the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glTexSubImage2D
Parameters
- AFormat
- the format of the texel data.
- AXOffset
- texel offset in the X direction within the texture array.
- AYOffset
- texel offset in the Y direction within the texture array.
- AWidth
- the width of the texture subimage.
- AHeight
- the height of the texture subimage.
- AData
- pointer to the image data in memory.
- ALevel
- (optional) level-of-detail number if updating separate mipmap levels. Level 0 (default) is the base image level. Level N is the Nth mipmap reduction image.
- AType
- (optional) data type the texel data. Defaults to UnsignedByte.
- ACubeTarget
- (optional) if this texture is a cube texture, then this parameter specifies which of the 6 cube faces to update. This parameter is ignored for 2D textures.
Exceptions raised
TGLError.InvalidValue
- if ALevel is less than 0 or greater than the maximum level.
TGLError.InvalidValue
- if AXOffset < 0 or AXOffset + AWidth is greater than the width of this texture.
TGLError.InvalidValue
- if AYOffset < 0 or AYOffset + AHeight is greater than the height of this texture.
TGLError.InvalidValue
- if AWidth or AHeight is less than 0.
TGLError.InvalidOperation
- if the texture array has not been defined by a previous Upload of Copy operation whose AFormat matches the AFormat parameter of this method.
TGLError.InvalidOperation
- if AType is UnsignedShort565 and AFormat is not RGB.
TGLError.InvalidOperation
- if AType is UnsignedShort4444 or UnsignedShort5551 and AFormat is not RGBA.
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- Upload
- Uploads an image to the texture.
- UploadCompressed
- Uploads a compressed image to the texture.
- SubUploadCompressed
- Uploads a part of a compressed image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
- SubCopy
- Copies pixels from a part of the current framebuffer into the texture.
- gl.PixelStore
- Set pixel storage alignment.
- GetMaxTextureSize
- Gets a rough estimate of the largest texture that the GL can handle.
- GetMaxCubeMapTextureSize
- Gets a rough estimate of the largest cube-map texture that the GL can handle.
|
procedure UploadCompressed(const AFormat: Cardinal; const AWidth, AHeight: Integer; const AData: Pointer; const ADataSize: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
Uploads a compressed image to the texture. This creates the texture in memory.
Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is active. Texturing is active when the current fragment shader or vertex shader makes use of built-in texture lookup functions.
This method defines a two-dimensional texture image or cube-map texture image using compressed image data from client memory. The texture image is decoded according to the extension specification defining the specified AFormat. OpenGL ES defines no specific compressed texture formats, but does provide a mechanism to obtain symbolic constants for such formats provided by extensions. The list of specific compressed texture formats supported can be obtained by GetCompressedTextureFormats.
Note: a GL implementation may choose to store the texture array at any internal resolution it chooses.
Note: this method specifies a two-dimensional or cube-map texture for the current texture unit, specified with BindToTextureUnit.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glCompressedTexImage2D
Parameters
- AFormat
- the compressed format of the texel data.
- AWidth
- the width of the texture image. All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide.
- AHeight
- the height of the texture image. All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high.
- AData
- pointer to the compressed image data in memory.
- ADataSize
- the size of the compressed image data in bytes.
- ALevel
- (optional) level-of-detail number if updating separate mipmap levels. Level 0 (default) is the base image level. Level N is the Nth mipmap reduction image.
- ACubeTarget
- (optional) if this texture is a cube texture, then this parameter specifies which of the 6 cube faces to update. This parameter is ignored for 2D textures.
Exceptions raised
TGLError.InvalidEnum
- if AFormat is not a supported format returned in GetCompressedTextureFormats.
TGLError.InvalidValue
- if ALevel is less than 0 or greater than the maximum level.
TGLError.InvalidValue
- if AWidth or AHeight is less than 0 or greater than the maximum texture size.
TGLError.InvalidValue
- if ADataSize is not consistent with the format, dimensions, and contents of the specified compressed image data.
TGLError.InvalidOperation
- if parameter combinations are not supported by the specific compressed internal format as specified in the specific texture compression extension.
Other
- Undefined results, including abnormal program termination, are generated if data is not encoded in a manner consistent with the extension specification defining the internal compression format.
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- Upload
- Uploads an image to the texture.
- SubUpload
- Uploads a part of an image to the texture.
- SubUploadCompressed
- Uploads a part of a compressed image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
- SubCopy
- Copies pixels from a part of the current framebuffer into the texture.
- GetMaxTextureSize
- Gets a rough estimate of the largest texture that the GL can handle.
- GetMaxCubeMapTextureSize
- Gets a rough estimate of the largest cube-map texture that the GL can handle.
- GetCompressedTextureFormats
- Gets a list of symbolic constants indicating which compressed texture formats are available.
|
procedure SubUploadCompressed(const AFormat: Cardinal; const AXOffset, AYOffset, AWidth, AHeight: Integer; const AData: Pointer; const ADataSize: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
Uploads a part of a compressed image to the texture. This updates the texture in memory.
Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is active. Texturing is active when the current fragment shader or vertex shader makes use of built-in texture lookup functions.
This method redefines a contiguous subregion of an existing two-dimensional texture image. The texels referenced by AData replace the portion of the existing texture array with X indices AXOffset and AXoffset + AWidth - 1, and the Y indices AYOffset and AYOffset + AHeight - 1, inclusive. This region may not include any texels outside the range of the texture array as it was originally specified. It is not an error to specify a subtexture with width of 0, but such a specification has no effect.
AFormat must be the same extension-specified compressed-texture format previously specified by UploadCompressed.
Note: this method specifies a two-dimensional or cube-map texture for the current texture unit, specified with BindToTextureUnit.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glCompressedTexSubImage2D
Parameters
- AFormat
- the compressed format of the texel data.
- AXOffset
- texel offset in the X direction within the texture array.
- AYOffset
- texel offset in the Y direction within the texture array.
- AWidth
- the width of the texture subimage.
- AHeight
- the height of the texture subimage.
- AData
- pointer to the compressed image data in memory.
- ADataSize
- the size of the compressed image data in bytes.
- ALevel
- (optional) level-of-detail number if updating separate mipmap levels. Level 0 (default) is the base image level. Level N is the Nth mipmap reduction image.
- ACubeTarget
- (optional) if this texture is a cube texture, then this parameter specifies which of the 6 cube faces to update. This parameter is ignored for 2D textures.
Exceptions raised
TGLError.InvalidEnum
- if AFormat is not a supported format returned in GetCompressedTextureFormats.
TGLError.InvalidValue
- if ALevel is less than 0 or greater than the maximum level.
TGLError.InvalidValue
- if AXOffset < 0 or AXOffset + AWidth is greater than the width of this texture.
TGLError.InvalidValue
- if AYOffset < 0 or AYOffset + AHeight is greater than the height of this texture.
TGLError.InvalidValue
- if AWidth or AHeight is less than 0.
TGLError.InvalidValue
- if ADataSize is not consistent with the format, dimensions, and contents of the specified compressed image data.
TGLError.InvalidOperation
- if the texture array has not been defined by a previous UploadCompressed operation whose AFormat matches the format of this method.
TGLError.InvalidOperation
- if parameter combinations are not supported by the specific compressed internal format as specified in the specific texture compression extension.
Other
- Undefined results, including abnormal program termination, are generated if data is not encoded in a manner consistent with the extension specification defining the internal compression format.
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- Upload
- Uploads an image to the texture.
- SubUpload
- Uploads a part of an image to the texture.
- UploadCompressed
- Uploads a compressed image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
- SubCopy
- Copies pixels from a part of the current framebuffer into the texture.
- GetMaxTextureSize
- Gets a rough estimate of the largest texture that the GL can handle.
- GetMaxCubeMapTextureSize
- Gets a rough estimate of the largest cube-map texture that the GL can handle.
- GetCompressedTextureFormats
- Gets a list of symbolic constants indicating which compressed texture formats are available.
|
procedure Copy(const AFormat: TGLPixelFormat; const ALeft, ABottom, AWidth, AHeight: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
Copies pixels from the current framebuffer into the texture.
This method defines a two-dimensional texture image or cube-map texture image with pixels from the current framebuffer (rather than from client memory, as is the case for Upload).
The screen-aligned pixel rectangle with lower left corner at (ALeft, ABottom) and with a width of AWidth and a height of AHeight defines the texture array at the mipmap level specified by ALevel. AFormat specifies the internal format of the texture array.
The pixels in the rectangle are processed exactly as if TGLFramebuffer.ReadPixels had been called with format set to RGBA, but the process stops just after conversion of RGBA values. Subsequent processing is identical to that described for Upload, beginning with the clamping of the R, G, B, and A values to the range 0-1 and then conversion to the texture's internal format for storage in the texel array.
The components required for AFormat must be a subset of those present in the framebuffer's format. For example, a RGBA framebuffer can be used to supply components for any AFormat. However, a RGB framebuffer can only be used to supply components for RGB or Luminance base internal format textures, not Alpha, LuminanceAlpha or RGBA textures.
Pixel ordering is such that lower ALeft and ABottom screen coordinates correspond to lower S and T texture coordinates.
If any of the pixels within the specified rectangle are outside the framebuffer associated with the current rendering context, then the values obtained for those pixels are undefined.
Note: a GL implementation may choose to store the texture array at any internal resolution it chooses.
Note: an image with height or width of 0 indicates a NULL texture.
Note: This method specifies a two-dimensional or cube-map texture for the current texture unit, specified with BindToTextureUnit.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glCopyTexImage2D
Parameters
- AFormat
- the format of the texel data.
- ALeft
- window coordinate of the left corner of the rectangular region of pixels to be copied.
- ABottom
- window coordinate of the bottom corner of the rectangular region of pixels to be copied.
- AWidth
- the width of the texture image. All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide.
- AHeight
- the height of the texture image. All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high.
- ALevel
- (optional) level-of-detail number if updating separate mipmap levels. Level 0 (default) is the base image level. Level N is the Nth mipmap reduction image.
- ACubeTarget
- (optional) if this texture is a cube texture, then this parameter specifies which of the 6 cube faces to update. This parameter is ignored for 2D textures.
Exceptions raised
TGLError.InvalidValue
- if this is a cube map texture and the AWidth and AHeight parameters are not equal.
TGLError.InvalidValue
- if ALevel is less than 0 or greater than the maximum level.
TGLError.InvalidValue
- if AWidth or AHeight is less than 0 or greater than then maximum texture size.
TGLError.InvalidOperation
- if the currently bound framebuffer's format does not contain a superset of the components required by the base format of AFormat.
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- TGLFrameBuffer.Status
- Return the framebuffer completeness
status .
- Upload
- Uploads an image to the texture.
- UploadCompressed
- Uploads a compressed image to the texture.
- SubUpload
- Uploads a part of an image to the texture.
- SubUploadCompressed
- Uploads a part of a compressed image to the texture.
- SubCopy
- Copies pixels from a part of the current framebuffer into the texture.
- GetMaxTextureSize
- Gets a rough estimate of the largest texture that the GL can handle.
- GetMaxCubeMapTextureSize
- Gets a rough estimate of the largest cube-map texture that the GL can handle.
|
procedure SubCopy(const AXOffset, AYOffset, ALeft, ABottom, AWidth, AHeight: Integer; const ALevel: Integer = 0; const ACubeTarget: TGLCubeTarget = 0); inline; |
Copies pixels from a part of the current framebuffer into the texture.
This method replaces a rectangular portion of a two-dimensional texture image or cube-map texture image with pixels from the current framebuffer (rather than from client memory, as is the case for SubUpload).
The screen-aligned pixel rectangle with lower left corner at ALeft, ABottom and with width AWidth and height AHeight replaces the portion of the texture array with X indices AXOffset through AXOffset + AWidth - 1, inclusive, and Y indices AYOffset through AYOffset + AHeight - 1, inclusive, at the mipmap level specified by level.
The pixels in the rectangle are processed exactly as if TGLFramebuffer.ReadPixels had been called with format set to RGBA, but the process stops just after conversion of RGBA values. Subsequent processing is identical to that described for SubUpload, beginning with the clamping of the R, G, B, and A values to the range 0-1 and then conversion to the texture's internal format for storage in the texel array.
The destination rectangle in the texture array may not include any texels outside the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.
If any of the pixels within the specified rectangle are outside the framebuffer associated with the current rendering context, then the values obtained for those pixels are undefined.
No change is made to the internalformat, width, or height parameters of the texture array or to texel values outside the specified subregion.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this texture is not bound.
OpenGL API: glCopyTexSubImage2D
Parameters
- AXOffset
- texel offset in the X direction within the texture array.
- AYOffset
- texel offset in the Y direction within the texture array.
- ALeft
- window coordinate of the left corner of the rectangular region of pixels to be copied.
- ABottom
- window coordinate of the bottom corner of the rectangular region of pixels to be copied.
- AWidth
- the width of the texture subimage.
- AHeight
- the height of the texture subimage.
- ALevel
- (optional) level-of-detail number if updating separate mipmap levels. Level 0 (default) is the base image level. Level N is the Nth mipmap reduction image.
- ACubeTarget
- (optional) if this texture is a cube texture, then this parameter specifies which of the 6 cube faces to update. This parameter is ignored for 2D textures.
Exceptions raised
TGLError.InvalidValue
- if ALevel is less than 0 or greater than the maximum level.
TGLError.InvalidValue
- if AXOffset < 0 or AXOffset + AWidth is greater than the width of this texture.
TGLError.InvalidValue
- if AYOffset < 0 or AYOffset + AHeight is greater than the height of this texture.
TGLError.InvalidValue
- if AWidth or AHeight is less than 0.
TGLError.InvalidOperation
- if the texture array has not been defined by a previous Upload of Copy operation whose AFormat matches the AFormat parameter of this method.
TGLError.InvalidOperation
- if the currently bound framebuffer's format does not contain a superset of the components required by the base format of AFormat.
TGLError.InvalidFramebufferOperation
- if the currently bound framebuffer is not framebuffer complete.
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- TGLFrameBuffer.Status
- Return the framebuffer completeness
status .
- Upload
- Uploads an image to the texture.
- UploadCompressed
- Uploads a compressed image to the texture.
- SubUploadCompressed
- Uploads a part of a compressed image to the texture.
- Copy
- Copies pixels from the current framebuffer into the texture.
- GetMaxTextureSize
- Gets a rough estimate of the largest texture that the GL can handle.
- GetMaxCubeMapTextureSize
- Gets a rough estimate of the largest cube-map texture that the GL can handle.
|
class function GetCurrent2DTexture: TGLTexture; inline; static; |
Get the 2D texture that is currently bound for the active multitexture unit.
OpenGL API: glGetProgramiv(GL_TEXTURE_BINDING_2D)
Returns
The currently bound 2D texture. Its Handle will be 0 if there is no 2D texture bound. See also
- Bind
- Binds the texture.
- GetCurrentCubeMapTexture
- Get the cubemap texture that is currently bound for the active multitexture unit.
|
class function GetCurrentCubemapTexture: TGLTexture; inline; static; |
Get the cubemap texture that is currently bound for the active multitexture unit.
OpenGL API: glGetProgramiv(GL_TEXTURE_BINDING_CUBE_MAP)
Returns
The currently bound cubemap texture. Its Handle will be 0 if there is no cubemap texture bound. See also
- Bind
- Binds the texture.
- GetCurrent2DTexture
- Get the 2D texture that is currently bound for the active multitexture unit.
|
class function GetActiveTextureUnit: Integer; inline; static; |
Gets the active texture unit.
OpenGL API: glGetIntegerv(GL_ACTIVE_TEXTURE)
Returns
The index active multitexture unit, ranging from 0 to GetMaxTextureUnits - 1. See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- GetMaxTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the fragment shader.
- GetMaxCombinedTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined.
|
class function GetCompressedTextureFormats: TArray<Cardinal>; inline; static; |
Gets a list of symbolic constants indicating which compressed texture formats are available. May be empty.
OpenGL API: glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS/GL_COMPRESSED_TEXTURE_FORMATS)
Returns
A list of compressed texture formats. See also
- UploadCompressed
- Uploads a compressed image to the texture.
- SubUploadCompressed
- Uploads a part of a compressed image to the texture.
|
class procedure MipmapHint(const AHint: TGLMipmapHint); inline; static; |
Sets an implementation-specific hint for generating mipmaps.
Note: this is a global setting that effects all textures.
OpenGL API: glHint
Parameters
- AHint
- the preference for generating mipmaps.
See also
- GenerateMipmap
- Generate a complete set of mipmaps for this texture object.
- GetMipmapHint
- Gets the current implementation-specific hint for generating mipmaps.
|
class function GetMipmapHint: TGLMipmapHint; inline; static; |
Gets the current implementation-specific hint for generating mipmaps.
OpenGL API: glGetIntegerv(GL_GENERATE_MIPMAP_HINT)
Returns
The mipmap generation preference. See also
- GenerateMipmap
- Generate a complete set of mipmaps for this texture object.
- MipmapHint
- Sets an implementation-specific hint for generating mipmaps.
|
class function GetMaxTextureUnits: Integer; inline; static; |
Gets the maximum supported texture image units that can be used to access texture maps from the fragment shader. The value must be at least 8.
OpenGL API: glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS)
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- GetMaxCombinedTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined.
- GetMaxVertexTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader.
|
class function GetMaxCombinedTextureUnits: Integer; inline; static; |
Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined. If both the vertex shader and the fragment processing stage access the same texture image unit, then that counts as using two texture image units against this limit. The value must be at least 8.
OpenGL API: glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- GetMaxTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the fragment shader.
- GetMaxVertexTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader.
|
class function GetMaxVertexTextureUnits: Integer; inline; static; |
Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader. The value may be 0.
OpenGL API: glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)
See also
- BindToTextureUnit
- Actives a texture unit and binds this texture to that unit.
- GetMaxTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the fragment shader.
- GetMaxCombinedTextureUnits
- Gets the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined.
|
class function GetMaxTextureSize: Integer; inline; static; |
Gets a rough estimate of the largest texture that the GL can handle. The value must be at least 64.
OpenGL API: glGetIntegerv(GL_MAX_TEXTURE_SIZE)
See also
- Upload
- Uploads an image to the texture.
|
class function GetMaxCubeMapTextureSize: Integer; inline; static; |
Gets a rough estimate of the largest cube-map texture that the GL can handle. The value must be at least 16.
OpenGL API: glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE)
See also
- Upload
- Uploads an image to the texture.
|
Properties
property Handle: GLuint read FHandle; |
OpenGL handle to the texture object.
|
Generated by PasDocEx, based on PasDoc 0.14.0.
|