Class TTexture

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TTexture = class(TReferenceCounted)

Description

Interface of a Video Driver dependent Texture.
An ITexture is created by an IVideoDriver by using TVideoDriver.AddTexture or TVideoDriver.GetTexture. After that, the texture may only be used by this VideoDriver. As you can imagine, textures of the DirectX and the OpenGL device will, e.g., not be compatible. An exception is the Software device and the null device, their textures are compatible. If you try to use a texture created by one device with an other device, the device will refuse to do that and write a warning or an error message to the output buffer.

Hierarchy

Overview

Methods

Public function IsRenderTarget: Boolean; inline;
Public function Lock(ReadOnly: Boolean=False; MipMapLevel: LongWord=0): Pointer; inline;
Public procedure RegenerateMipMapLevels(MipMapData: Pointer=nil); inline;
Public procedure Unlock; inline;

Properties

Public property ColorFormat: TColorFormat read GetColorFormat;
Public property DriverType: TVideoDriverType read GetDriverType;
Public property HasAlpha: Boolean read GetAlpha;
Public property HasMipMaps: Boolean read GetMipMaps;
Public property Name: StringType read GetName;
Public property OriginalSize: TSize read GetOriginalSize;
Public property Size: TSize read GetSize;

Description

Methods

Public function IsRenderTarget: Boolean; inline;

Returns whether the texture is a render target.

Public function Lock(ReadOnly: Boolean=False; MipMapLevel: LongWord=0): Pointer; inline;

Locks the Texture and returns a pointer to access the pixels. After lock() has been called and all operations on the pixels are done, you must call unlock(). Locks are not accumulating, hence one unlock will do for an arbitrary number of previous locks.

Parameters
ReadOnly
Specifies that no changes to the locked texture are made. Unspecified behavior will arise if still write access happens.
MipMapLevel
Number of the mipmapLevel to lock. 0 is main texture. Non-existing levels will silently fail and return 0.
Returns

A pointer to the pixel data. The format of the pixel can be determined by reading ColorFormat. 0 is returned if the texture cannot be locked.

Public procedure RegenerateMipMapLevels(MipMapData: Pointer=nil); inline;

Regenerates the mip map levels of the texture.
Required after modifying the texture, usually after calling unlock().

Public procedure Unlock; inline;

Unlock function. Must be called after a lock() to the texture.
One should avoid to call unlock more than once before another lock.

Properties

Public property ColorFormat: TColorFormat read GetColorFormat;

The texture's color format.

Public property DriverType: TVideoDriverType read GetDriverType;

The driver type this texture was created for. This method is used internally by the video devices, to check if they may use a texture because textures may be incompatible between different devices.

Public property HasAlpha: Boolean read GetAlpha;

Whether the texture has an alpha channel.

Public property HasMipMaps: Boolean read GetMipMaps;

Whether the texture has MipMaps.

Public property Name: StringType read GetName;

The texture's name (in most cases this is the filename).

Public property OriginalSize: TSize read GetOriginalSize;

Get original size of the texture.
The texture is usually scaled, if it was created with an unoptimal size. For example if the size was not a power of two. This method returns the size of the texture it had before it was scaled. Can be useful when drawing 2d images on the screen, which should have the exact size of the original texture. Use TTexture.GetSize() if you want to know the real size it has now stored in the system.

Public property Size: TSize read GetSize;

The texture's size.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22