# Class TglBitmap

Description | Hierarchy | Fields | Methods | Properties

## Unit

glBitmap

## 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

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

### Methods

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

### Properties

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

## Description

### Fields

| `fID: GLuint;`
name of the OpenGL texture object

| `fTarget: GLuint;`
texture target (e.g. GL_TEXTURE_2D)

| `fAnisotropic: Integer;`
anisotropic level

| `fDeleteTextureOnFree: Boolean;`
delete OpenGL texture object when this object is destroyed

| `fFreeDataOnDestroy: Boolean;`
free stored data when this object is destroyed

| `fFreeDataAfterGenTexture: Boolean;`
free stored data after data was uploaded to video card

| `fData: PByte;`
data of this texture

| `fBorderColor: array[0..3] of Single;`
color of the texture border

| `fDimension: TglBitmapSize;`
size of this texture

| `fMipMap: TglBitmapMipMap;`
mipmap type

| `fFormat: TglBitmapFormat;`
format the texture data is stored in

| `fPixelSize: Integer;`
size of one pixel (in byte)

| `fRowSize: Integer;`
size of one pixel row (in byte)

| `fFilterMin: GLenum;`
min filter to apply to the texture

| `fFilterMag: GLenum;`
mag filter to apply to the texture

| `fWrapS: GLenum;`
texture wrapping for x axis

| `fWrapT: GLenum;`
texture wrapping for y axis

| `fWrapR: GLenum;`
texture wrapping for z axis

| `fSwizzle: array[0..3] of GLenum;`
color channel swizzle

| `fFilename: String;`
filename the texture was load from

| `fCustomName: String;`
user defined name

| `fCustomNameW: WideString;`
user defined name

| `fCustomData: Pointer;`
user defined data

### Methods

| `function GetFormatDesc: TglBitmapFormatDescriptor;`

###### Returns

format descriptor that describes the format of the stored data

| `function GetWidth: Integer; virtual;`

###### Returns

the actual width of the texture

| `function GetHeight: Integer; virtual;`

###### Returns

the actual height of the texture

| `function GetFileWidth: Integer; virtual;`

###### Returns

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

| `function GetFileHeight: Integer; virtual;`

###### Returns

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

| `procedure SetCustomData(const aValue: Pointer);`
set a new value for fCustomData

| `procedure SetCustomName(const aValue: String);`
set a new value for fCustomName

| `procedure SetCustomNameW(const aValue: WideString);`
set a new value for fCustomNameW

| `procedure SetFreeDataOnDestroy(const aValue: Boolean);`
set new value for fFreeDataOnDestroy

| `procedure SetDeleteTextureOnFree(const aValue: Boolean);`
set new value for fDeleteTextureOnFree

| `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

| `procedure SetFreeDataAfterGenTexture(const aValue: Boolean);`
set new value for fFreeDataAfterGenTexture

| `procedure SetID(const aValue: Cardinal);`
set name of OpenGL texture object

| `procedure SetMipMap(const aValue: TglBitmapMipMap);`
set new value for fMipMap

| `procedure SetTarget(const aValue: Cardinal);`
set new value for target

| `procedure SetAnisotropic(const aValue: Integer);`
set new value for fAnisotrophic

| `procedure CreateID;`
create OpenGL texture object (delete exisiting object if exists)

| `procedure SetupParameters();`
setup texture parameters

| `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

| `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

| `function FlipHorz: Boolean; virtual;`

flip texture horizontal

###### Returns

`True` in success, `False` otherwise

| `function FlipVert: Boolean; virtual;`

flip texture vertical

###### Returns

`True` in success, `False` otherwise

| `procedure AfterConstruction; override;`
this method is called after the constructor and sets the default values of this object

| `procedure BeforeDestruction; override;`
this method is called before the destructor and does some cleanup

| `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

| `procedure LoadFromFile(const aFilename: String);`

load a texture from a file

###### Parameters

aFilename
  file to load texuture from

| `procedure LoadFromStream(const aStream: TStream); virtual;`

load a texture from a stream

###### Parameters

aStream
  stream to load texture from

| `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)

| `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)

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `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

| `function RemoveAlpha: Boolean; virtual;`

remove alpha channel

###### Returns

`True` on success, `False` otherwise

| `function Clone: TglBitmap;`

create a clone of the current object

###### Returns

clone of this object

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

invert color data (xor)

###### Parameters

aUseRGB
  xor each color channel
aUseAlpha
  xor alpha channel

| `procedure FreeData;`
free texture stored data

| `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)

| `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)

| `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)

| `procedure SetFilter(const aMin, aMag: GLenum);`

set new texture filer

###### Parameters

aMin
  min filter
aMag
  mag filter

| `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

| `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

| `procedure Bind(const aEnableTextureUnit: Boolean = true); virtual;`

bind texture

###### Parameters

aEnableTextureUnit
  enable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D))

| `procedure Unbind(const aDisableTextureUnit: Boolean = true); virtual;`

bind texture

###### Parameters

aDisableTextureUnit
  disable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D))

| `constructor Create; overload;`
constructor - created an empty texture

| `constructor Create(const aFileName: String); overload;`

constructor - creates a texture and load it from a file

###### Parameters

aFilename
  file to load texture from

| `constructor Create(const aStream: TStream); overload;`

constructor - creates a texture and load it from a stream

###### Parameters

aStream
  stream to load texture from

| `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,

| `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)

| `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)

| `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)

| `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

| `procedure SaveRAW(const aStream: TStream);`

save texture data as RAW image to stream

###### Parameters

aStream
  stream to save data to

| `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

| `procedure SaveBMP(const aStream: TStream);`

save texture data as BMP to stream

###### Parameters

aStream
  stream to save data to

| `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

| `procedure SaveTGA(const aStream: TStream);`

save texture data as TGA to stream

###### Parameters

aStream
  stream to save data to

| `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

| `procedure SaveDDS(const aStream: TStream);`

save texture data as DDS to stream

###### Parameters

aStream
  stream to save data to

### Properties

| `property Width: Integer read GetWidth;`
the actual width of the texture

| `property Height: Integer read GetHeight;`
the actual height of the texture

| `property FileWidth: Integer read GetFileWidth;`
the width of the texture or 1 if the width is zero

| `property FileHeight: Integer read GetFileHeight;`
the height of the texture or 1 if the height is zero

| `property ID: Cardinal read fID write SetID;`
name of the OpenGL texture object

| `property Target: Cardinal read fTarget write SetTarget;`
texture target (e.g. GL_TEXTURE_2D)

| `property Format: TglBitmapFormat read fFormat write SetFormat;`
format the texture data is stored in

| `property MipMap: TglBitmapMipMap read fMipMap write SetMipMap;`
mipmap type

| `property Anisotropic: Integer read fAnisotropic write SetAnisotropic;`
anisotropic level

| `property FormatDesc: TglBitmapFormatDescriptor read GetFormatDesc;`
format descriptor that describes the format of the stored data

| `property Filename: String read fFilename;`
filename the texture was load from

| `property CustomName: String read fCustomName write SetCustomName;`
user defined name (use at will)

| `property CustomNameW: WideString read fCustomNameW write SetCustomNameW;`
user defined name (as WideString; use at will)

| `property CustomData: Pointer read fCustomData write SetCustomData;`
user defined data (use at will)

| `property DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;`
delete texture object when this object is destroyed

| `property FreeDataOnDestroy: Boolean read fFreeDataOnDestroy write SetFreeDataOnDestroy;`
free stored data when this object is destroyed

| `property FreeDataAfterGenTexture: Boolean read fFreeDataAfterGenTexture write SetFreeDataAfterGenTexture;`
free stored data after it is uplaoded to video card

| `property Dimension: TglBitmapSize read fDimension;`
size of the texture

| `property Data: PByte read fData;`
texture data (or `Nil` if unset)

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