Class TglBitmap

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TglBitmap = class(TObject)

Description

base class for all glBitmap classes. used to manage OpenGL texture objects and to load, save and manipulate texture data

Hierarchy

  • TObject
  • TglBitmap

Overview

Fields

Protected fID: GLuint;
Protected fTarget: GLuint;
Protected fAnisotropic: Integer;
Protected fDeleteTextureOnFree: Boolean;
Protected fFreeDataOnDestroy: Boolean;
Protected fFreeDataAfterGenTexture: Boolean;
Protected fData: PByte;
Protected fBorderColor: array[0..3] of Single;
Protected fDimension: TglBitmapSize;
Protected fMipMap: TglBitmapMipMap;
Protected fFormat: TglBitmapFormat;
Protected fPixelSize: Integer;
Protected fRowSize: Integer;
Protected fFilterMin: GLenum;
Protected fFilterMag: GLenum;
Protected fWrapS: GLenum;
Protected fWrapT: GLenum;
Protected fWrapR: GLenum;
Protected fSwizzle: array[0..3] of GLenum;
Protected fFilename: String;
Protected fCustomName: String;
Protected fCustomNameW: WideString;
Protected fCustomData: Pointer;

Methods

Private function GetFormatDesc: TglBitmapFormatDescriptor;
Protected function GetWidth: Integer; virtual;
Protected function GetHeight: Integer; virtual;
Protected function GetFileWidth: Integer; virtual;
Protected function GetFileHeight: Integer; virtual;
Protected procedure SetCustomData(const aValue: Pointer);
Protected procedure SetCustomName(const aValue: String);
Protected procedure SetCustomNameW(const aValue: WideString);
Protected procedure SetFreeDataOnDestroy(const aValue: Boolean);
Protected procedure SetDeleteTextureOnFree(const aValue: Boolean);
Protected procedure SetFormat(const aValue: TglBitmapFormat);
Protected procedure SetFreeDataAfterGenTexture(const aValue: Boolean);
Protected procedure SetID(const aValue: Cardinal);
Protected procedure SetMipMap(const aValue: TglBitmapMipMap);
Protected procedure SetTarget(const aValue: Cardinal);
Protected procedure SetAnisotropic(const aValue: Integer);
Protected procedure CreateID;
Protected procedure SetupParameters();
Protected procedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat; const aWidth: Integer = -1; const aHeight: Integer = -1); virtual;
Protected procedure GenTexture(const aTestTextureSize: Boolean = true); virtual; abstract;
Protected function FlipHorz: Boolean; virtual;
Protected function FlipVert: Boolean; virtual;
Public procedure AfterConstruction; override;
Public procedure BeforeDestruction; override;
Public procedure PrepareResType(var aResource: String; var aResType: PChar);
Public procedure LoadFromFile(const aFilename: String);
Public procedure LoadFromStream(const aStream: TStream); virtual;
Public procedure LoadFromFunc(const aSize: TglBitmapSize; const aFunc: TglBitmapFunction; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil);
Public procedure LoadFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil);
Public procedure LoadFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar);
Public procedure SaveToFile(const aFilename: String; const aFileType: TglBitmapFileType);
Public procedure SaveToStream(const aStream: TStream; const aFileType: TglBitmapFileType); virtual;
Public function Convert(const aFunc: TglBitmapFunction; const aCreateTemp: Boolean; const aArgs: Pointer = nil): Boolean; overload;
Public function Convert(const aSource: TglBitmap; const aFunc: TglBitmapFunction; aCreateTemp: Boolean; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil): Boolean; overload;
Public function ConvertTo(const aFormat: TglBitmapFormat): Boolean; virtual;
Public function AddAlphaFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Public function AddAlphaFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Public function AddAlphaFromFunc(const aFunc: TglBitmapFunction; const aArgs: Pointer = nil): Boolean; virtual;
Public function AddAlphaFromFile(const aFileName: String; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Public function AddAlphaFromStream(const aStream: TStream; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Public function AddAlphaFromGlBitmap(const aBitmap: TglBitmap; aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Public function AddAlphaFromColorKey(const aRed, aGreen, aBlue: Byte; const aDeviation: Byte = 0): Boolean;
Public function AddAlphaFromColorKeyRange(const aRed, aGreen, aBlue: Cardinal; const aDeviation: Cardinal = 0): Boolean;
Public function AddAlphaFromColorKeyFloat(const aRed, aGreen, aBlue: Single; const aDeviation: Single = 0): Boolean;
Public function AddAlphaFromValue(const aAlpha: Byte): Boolean;
Public function AddAlphaFromValueRange(const aAlpha: Cardinal): Boolean;
Public function AddAlphaFromValueFloat(const aAlpha: Single): Boolean;
Public function RemoveAlpha: Boolean; virtual;
Public function Clone: TglBitmap;
Public procedure Invert(const aUseRGB: Boolean = true; const aUseAlpha: Boolean = false);
Public procedure FreeData;
Public procedure FillWithColor(const aRed, aGreen, aBlue: Byte; const aAlpha: Byte = 255);
Public procedure FillWithColorRange(const aRed, aGreen, aBlue: Cardinal; const aAlpha: Cardinal = $FFFFFFFF);
Public procedure FillWithColorFloat(const aRed, aGreen, aBlue: Single; const aAlpha: Single = 1.0);
Public procedure SetFilter(const aMin, aMag: GLenum);
Public procedure SetWrap( const S: GLenum = GL_CLAMP_TO_EDGE; const T: GLenum = GL_CLAMP_TO_EDGE; const R: GLenum = GL_CLAMP_TO_EDGE);
Public procedure SetSwizzle(const r, g, b, a: GLenum);
Public procedure Bind(const aEnableTextureUnit: Boolean = true); virtual;
Public procedure Unbind(const aDisableTextureUnit: Boolean = true); virtual;
Public constructor Create; overload;
Public constructor Create(const aFileName: String); overload;
Public constructor Create(const aStream: TStream); overload;
Public constructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; aData: PByte = nil); overload;
Public constructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; const aFunc: TglBitmapFunction; const aArgs: Pointer = nil); overload;
Public constructor Create(const aInstance: Cardinal; const aResource: String; const aResType: PChar = nil); overload;
Public constructor Create(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar); overload;
Private function LoadRAW(const aStream: TStream): Boolean;
Private procedure SaveRAW(const aStream: TStream);
Private function LoadBMP(const aStream: TStream): Boolean;
Private procedure SaveBMP(const aStream: TStream);
Private function LoadTGA(const aStream: TStream): Boolean;
Private procedure SaveTGA(const aStream: TStream);
Private function LoadDDS(const aStream: TStream): Boolean;
Private procedure SaveDDS(const aStream: TStream);

Properties

Protected property Width: Integer read GetWidth;
Protected property Height: Integer read GetHeight;
Protected property FileWidth: Integer read GetFileWidth;
Protected property FileHeight: Integer read GetFileHeight;
Public property ID: Cardinal read fID write SetID;
Public property Target: Cardinal read fTarget write SetTarget;
Public property Format: TglBitmapFormat read fFormat write SetFormat;
Public property MipMap: TglBitmapMipMap read fMipMap write SetMipMap;
Public property Anisotropic: Integer read fAnisotropic write SetAnisotropic;
Public property FormatDesc: TglBitmapFormatDescriptor read GetFormatDesc;
Public property Filename: String read fFilename;
Public property CustomName: String read fCustomName write SetCustomName;
Public property CustomNameW: WideString read fCustomNameW write SetCustomNameW;
Public property CustomData: Pointer read fCustomData write SetCustomData;
Public property DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;
Public property FreeDataOnDestroy: Boolean read fFreeDataOnDestroy write SetFreeDataOnDestroy;
Public property FreeDataAfterGenTexture: Boolean read fFreeDataAfterGenTexture write SetFreeDataAfterGenTexture;
Public property Dimension: TglBitmapSize read fDimension;
Public property Data: PByte read fData;

Description

Fields

Protected fID: GLuint;

name of the OpenGL texture object

Protected fTarget: GLuint;

texture target (e.g. GL_TEXTURE_2D)

Protected fAnisotropic: Integer;

anisotropic level

Protected fDeleteTextureOnFree: Boolean;

delete OpenGL texture object when this object is destroyed

Protected fFreeDataOnDestroy: Boolean;

free stored data when this object is destroyed

Protected fFreeDataAfterGenTexture: Boolean;

free stored data after data was uploaded to video card

Protected fData: PByte;

data of this texture

Protected fBorderColor: array[0..3] of Single;

color of the texture border

Protected fDimension: TglBitmapSize;

size of this texture

Protected fMipMap: TglBitmapMipMap;

mipmap type

Protected fFormat: TglBitmapFormat;

format the texture data is stored in

Protected fPixelSize: Integer;

size of one pixel (in byte)

Protected fRowSize: Integer;

size of one pixel row (in byte)

Protected fFilterMin: GLenum;

min filter to apply to the texture

Protected fFilterMag: GLenum;

mag filter to apply to the texture

Protected fWrapS: GLenum;

texture wrapping for x axis

Protected fWrapT: GLenum;

texture wrapping for y axis

Protected fWrapR: GLenum;

texture wrapping for z axis

Protected fSwizzle: array[0..3] of GLenum;

color channel swizzle

Protected fFilename: String;

filename the texture was load from

Protected fCustomName: String;

user defined name

Protected fCustomNameW: WideString;

user defined name

Protected fCustomData: Pointer;

user defined data

Methods

Private function GetFormatDesc: TglBitmapFormatDescriptor;
 
Returns

format descriptor that describes the format of the stored data

Protected function GetWidth: Integer; virtual;
 
Returns

the actual width of the texture

Protected function GetHeight: Integer; virtual;
 
Returns

the actual height of the texture

Protected function GetFileWidth: Integer; virtual;
 
Returns

the width of the texture or 1 if the width is zero

Protected function GetFileHeight: Integer; virtual;
 
Returns

the height of the texture or 1 if the height is zero

Protected procedure SetCustomData(const aValue: Pointer);

set a new value for fCustomData

Protected procedure SetCustomName(const aValue: String);

set a new value for fCustomName

Protected procedure SetCustomNameW(const aValue: WideString);

set a new value for fCustomNameW

Protected procedure SetFreeDataOnDestroy(const aValue: Boolean);

set new value for fFreeDataOnDestroy

Protected procedure SetDeleteTextureOnFree(const aValue: Boolean);

set new value for fDeleteTextureOnFree

Protected procedure SetFormat(const aValue: TglBitmapFormat);

set new value for the data format. only possible if new format has the same pixel size. if you want to convert the texture data, see ConvertTo function

Protected procedure SetFreeDataAfterGenTexture(const aValue: Boolean);

set new value for fFreeDataAfterGenTexture

Protected procedure SetID(const aValue: Cardinal);

set name of OpenGL texture object

Protected procedure SetMipMap(const aValue: TglBitmapMipMap);

set new value for fMipMap

Protected procedure SetTarget(const aValue: Cardinal);

set new value for target

Protected procedure SetAnisotropic(const aValue: Integer);

set new value for fAnisotrophic

Protected procedure CreateID;

create OpenGL texture object (delete exisiting object if exists)

Protected procedure SetupParameters();

setup texture parameters

Protected procedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat; const aWidth: Integer = -1; const aHeight: Integer = -1); virtual;

set data pointer of texture data

Parameters
aData
pointer to new texture data (be carefull, aData could be freed by this function)
aFormat
format of the data stored at aData
aWidth
width of the texture data
aHeight
height of the texture data
Protected procedure GenTexture(const aTestTextureSize: Boolean = true); virtual; abstract;

generate texture (upload texture data to video card)

Parameters
aTestTextureSize
test texture size before uploading and raise exception if something is wrong
Protected function FlipHorz: Boolean; virtual;

flip texture horizontal

Returns

True in success, False otherwise

Protected function FlipVert: Boolean; virtual;

flip texture vertical

Returns

True in success, False otherwise

Public procedure AfterConstruction; override;

this method is called after the constructor and sets the default values of this object

Public procedure BeforeDestruction; override;

this method is called before the destructor and does some cleanup

Public procedure PrepareResType(var aResource: String; var aResType: PChar);

splits a resource identifier into the resource and it's type

Parameters
aResource
resource identifier to split and store name in
aResType
type of the resource
Public procedure LoadFromFile(const aFilename: String);

load a texture from a file

Parameters
aFilename
file to load texuture from
Public procedure LoadFromStream(const aStream: TStream); virtual;

load a texture from a stream

Parameters
aStream
stream to load texture from
Public procedure LoadFromFunc(const aSize: TglBitmapSize; const aFunc: TglBitmapFunction; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil);

use a function to generate texture data

Parameters
aSize
size of the texture
aFunc
callback to use for generation
aFormat
format of the texture data
aArgs
user defined paramaters (use at will)
Public procedure LoadFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil);

load a texture from a resource

Parameters
aInstance
resource handle
aResource
resource indentifier
aResType
resource type (if known)
Public procedure LoadFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar);

load a texture from a resource id

Parameters
aInstance
resource handle
aResource
resource ID
aResType
resource type
Public procedure SaveToFile(const aFilename: String; const aFileType: TglBitmapFileType);

save texture data to a file

Parameters
aFilename
filename to store texture in
aFileType
file type to store data into
Public procedure SaveToStream(const aStream: TStream; const aFileType: TglBitmapFileType); virtual;

save texture data to a stream

Parameters
aFilename
filename to store texture in
aFileType
file type to store data into
Public function Convert(const aFunc: TglBitmapFunction; const aCreateTemp: Boolean; const aArgs: Pointer = nil): Boolean; overload;

convert texture data using a user defined callback

Parameters
aFunc
callback to use for converting
aCreateTemp
create a temporary buffer to use for converting
aArgs
user defined paramters (use at will)
Returns

True if converting was successful, False otherwise

Public function Convert(const aSource: TglBitmap; const aFunc: TglBitmapFunction; aCreateTemp: Boolean; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil): Boolean; overload;

convert texture data using a user defined callback

Parameters
aSource
glBitmap to read data from
aFunc
callback to use for converting
aCreateTemp
create a temporary buffer to use for converting
aFormat
format of the new data
aArgs
user defined paramters (use at will)
Returns

True if converting was successful, False otherwise

Public function ConvertTo(const aFormat: TglBitmapFormat): Boolean; virtual;

convert texture data using a specific format

Parameters
aFormat
new format of texture data
Returns

True if converting was successful, False otherwise

Public function AddAlphaFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;

load alpha channel data from resource

Parameters
aInstance
resource handle
aResource
resource ID
aResType
resource type
aFunc
callback to use for converting
aArgs
user defined parameters (use at will)
Returns

True on success, False otherwise

Public function AddAlphaFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;

load alpha channel data from resource ID

Parameters
aInstance
resource handle
aResourceID
resource ID
aResType
resource type
aFunc
callback to use for converting
aArgs
user defined parameters (use at will)
Returns

True on success, False otherwise

Public function AddAlphaFromFunc(const aFunc: TglBitmapFunction; const aArgs: Pointer = nil): Boolean; virtual;

add alpha channel data from function

Parameters
aFunc
callback to get data from
aArgs
user defined parameters (use at will)
Returns

True on success, False otherwise

Public function AddAlphaFromFile(const aFileName: String; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;

add alpha channel data from file (macro for: new glBitmap, LoadFromFile, AddAlphaFromGlBitmap)

Parameters
aFilename
file to load alpha channel data from
aFunc
callback to use for converting
aArgs
user defined parameters (use at will)
Returns

True on success, False otherwise

Public function AddAlphaFromStream(const aStream: TStream; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;

add alpha channel data from stream (macro for: new glBitmap, LoadFromStream, AddAlphaFromGlBitmap)

Parameters
aStream
stream to load alpha channel data from
aFunc
callback to use for converting
aArgs
user defined parameters (use at will)
Returns

True on success, False otherwise

Public function AddAlphaFromGlBitmap(const aBitmap: TglBitmap; aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;

add alpha channel data from existing glBitmap object

Parameters
aBitmap
TglBitmap to copy alpha channel data from
aFunc
callback to use for converting
aArgs
user defined parameters (use at will)
Returns

True on success, False otherwise

Public function AddAlphaFromColorKey(const aRed, aGreen, aBlue: Byte; const aDeviation: Byte = 0): Boolean;

add alpha to pixel if the pixels color is greter than the given color value

Parameters
aRed
red threshold (0-255)
aGreen
green threshold (0-255)
aBlue
blue threshold (0-255)
aDeviatation
accepted deviatation (0-255)
Returns

True on success, False otherwise

Public function AddAlphaFromColorKeyRange(const aRed, aGreen, aBlue: Cardinal; const aDeviation: Cardinal = 0): Boolean;

add alpha to pixel if the pixels color is greter than the given color value

Parameters
aRed
red threshold (0-Range.r)
aGreen
green threshold (0-Range.g)
aBlue
blue threshold (0-Range.b)
aDeviatation
accepted deviatation (0-max(Range.rgb))
Returns

True on success, False otherwise

Public function AddAlphaFromColorKeyFloat(const aRed, aGreen, aBlue: Single; const aDeviation: Single = 0): Boolean;

add alpha to pixel if the pixels color is greter than the given color value

Parameters
aRed
red threshold (0.0-1.0)
aGreen
green threshold (0.0-1.0)
aBlue
blue threshold (0.0-1.0)
aDeviatation
accepted deviatation (0.0-1.0)
Returns

True on success, False otherwise

Public function AddAlphaFromValue(const aAlpha: Byte): Boolean;

add a constand alpha value to all pixels

Parameters
aAlpha
alpha value to add (0-255)
Returns

True on success, False otherwise

Public function AddAlphaFromValueRange(const aAlpha: Cardinal): Boolean;

add a constand alpha value to all pixels

Parameters
aAlpha
alpha value to add (0-max(Range.rgb))
Returns

True on success, False otherwise

Public function AddAlphaFromValueFloat(const aAlpha: Single): Boolean;

add a constand alpha value to all pixels

Parameters
aAlpha
alpha value to add (0.0-1.0)
Returns

True on success, False otherwise

Public function RemoveAlpha: Boolean; virtual;

remove alpha channel

Returns

True on success, False otherwise

Public function Clone: TglBitmap;

create a clone of the current object

Returns

clone of this object

Public procedure Invert(const aUseRGB: Boolean = true; const aUseAlpha: Boolean = false);

invert color data (xor)

Parameters
aUseRGB
xor each color channel
aUseAlpha
xor alpha channel
Public procedure FreeData;

free texture stored data

Public procedure FillWithColor(const aRed, aGreen, aBlue: Byte; const aAlpha: Byte = 255);

fill complete texture with one color

Parameters
aRed
red color for border (0-255)
aGreen
green color for border (0-255)
aBlue
blue color for border (0-255)
aAlpha
alpha color for border (0-255)
Public procedure FillWithColorRange(const aRed, aGreen, aBlue: Cardinal; const aAlpha: Cardinal = $FFFFFFFF);

fill complete texture with one color

Parameters
aRed
red color for border (0-Range.r)
aGreen
green color for border (0-Range.g)
aBlue
blue color for border (0-Range.b)
aAlpha
alpha color for border (0-Range.a)
Public procedure FillWithColorFloat(const aRed, aGreen, aBlue: Single; const aAlpha: Single = 1.0);

fill complete texture with one color

Parameters
aRed
red color for border (0.0-1.0)
aGreen
green color for border (0.0-1.0)
aBlue
blue color for border (0.0-1.0)
aAlpha
alpha color for border (0.0-1.0)
Public procedure SetFilter(const aMin, aMag: GLenum);

set new texture filer

Parameters
aMin
min filter
aMag
mag filter
Public procedure SetWrap( const S: GLenum = GL_CLAMP_TO_EDGE; const T: GLenum = GL_CLAMP_TO_EDGE; const R: GLenum = GL_CLAMP_TO_EDGE);

set new texture wrapping

Parameters
S
texture wrapping for x axis
T
texture wrapping for y axis
R
texture wrapping for z axis
Public procedure SetSwizzle(const r, g, b, a: GLenum);

set new swizzle

Parameters
r
swizzle for red channel
g
swizzle for green channel
b
swizzle for blue channel
a
swizzle for alpha channel
Public procedure Bind(const aEnableTextureUnit: Boolean = true); virtual;

bind texture

Parameters
aEnableTextureUnit
enable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D))
Public procedure Unbind(const aDisableTextureUnit: Boolean = true); virtual;

bind texture

Parameters
aDisableTextureUnit
disable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D))
Public constructor Create; overload;

constructor - created an empty texture

Public constructor Create(const aFileName: String); overload;

constructor - creates a texture and load it from a file

Parameters
aFilename
file to load texture from
Public constructor Create(const aStream: TStream); overload;

constructor - creates a texture and load it from a stream

Parameters
aStream
stream to load texture from
Public constructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; aData: PByte = nil); overload;

constructor - creates a texture with the given size, format and data you can control this by setting DeleteTextureOnFree, FreeDataOnDestroy and FreeDataAfterGenTexture

Parameters
aSize
size of the texture
aFormat
format of the given data
aData
texture data - be carefull: the data will now be managed by the glBitmap object,
Public constructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; const aFunc: TglBitmapFunction; const aArgs: Pointer = nil); overload;

constructor - creates a texture with the given size and format and uses the given callback to create the data

Parameters
aSize
size of the texture
aFormat
format of the given data
aFunc
callback to use for generating the data
aArgs
user defined parameters (use at will)
Public constructor Create(const aInstance: Cardinal; const aResource: String; const aResType: PChar = nil); overload;

constructor - creates a texture and loads it from a resource

Parameters
aInstance
resource handle
aResource
resource indentifier
aResType
resource type (if known)
Public constructor Create(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar); overload;

constructor - creates a texture and loads it from a resource

Parameters
aInstance
resource handle
aResourceID
resource ID
aResType
resource type (if known)
Private function LoadRAW(const aStream: TStream): Boolean;

try to load a RAW image from a stream

Parameters
aStream
stream to load RAW image from
Returns

True on success, False otherwise

Private procedure SaveRAW(const aStream: TStream);

save texture data as RAW image to stream

Parameters
aStream
stream to save data to
Private function LoadBMP(const aStream: TStream): Boolean;

try to load a BMP from a stream

Parameters
aStream
stream to load BMP from
Returns

True on success, False otherwise

Private procedure SaveBMP(const aStream: TStream);

save texture data as BMP to stream

Parameters
aStream
stream to save data to
Private function LoadTGA(const aStream: TStream): Boolean;

try to load a TGA from a stream

Parameters
aStream
stream to load TGA from
Returns

True on success, False otherwise

Private procedure SaveTGA(const aStream: TStream);

save texture data as TGA to stream

Parameters
aStream
stream to save data to
Private function LoadDDS(const aStream: TStream): Boolean;

try to load a DDS from a stream

Parameters
aStream
stream to load DDS from
Returns

True on success, False otherwise

Private procedure SaveDDS(const aStream: TStream);

save texture data as DDS to stream

Parameters
aStream
stream to save data to

Properties

Protected property Width: Integer read GetWidth;

the actual width of the texture

Protected property Height: Integer read GetHeight;

the actual height of the texture

Protected property FileWidth: Integer read GetFileWidth;

the width of the texture or 1 if the width is zero

Protected property FileHeight: Integer read GetFileHeight;

the height of the texture or 1 if the height is zero

Public property ID: Cardinal read fID write SetID;

name of the OpenGL texture object

Public property Target: Cardinal read fTarget write SetTarget;

texture target (e.g. GL_TEXTURE_2D)

Public property Format: TglBitmapFormat read fFormat write SetFormat;

format the texture data is stored in

Public property MipMap: TglBitmapMipMap read fMipMap write SetMipMap;

mipmap type

Public property Anisotropic: Integer read fAnisotropic write SetAnisotropic;

anisotropic level

Public property FormatDesc: TglBitmapFormatDescriptor read GetFormatDesc;

format descriptor that describes the format of the stored data

Public property Filename: String read fFilename;

filename the texture was load from

Public property CustomName: String read fCustomName write SetCustomName;

user defined name (use at will)

Public property CustomNameW: WideString read fCustomNameW write SetCustomNameW;

user defined name (as WideString; use at will)

Public property CustomData: Pointer read fCustomData write SetCustomData;

user defined data (use at will)

Public property DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;

delete texture object when this object is destroyed

Public property FreeDataOnDestroy: Boolean read fFreeDataOnDestroy write SetFreeDataOnDestroy;

free stored data when this object is destroyed

Public property FreeDataAfterGenTexture: Boolean read fFreeDataAfterGenTexture write SetFreeDataAfterGenTexture;

free stored data after it is uplaoded to video card

Public property Dimension: TglBitmapSize read fDimension;

size of the texture

Public property Data: PByte read fData;

texture data (or Nil if unset)


Generated by PasDoc 0.13.0 on 2014-12-21 15:05:48