# 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 all operations on a bitmap object must be done from the render thread

## Hierarchy

- TObject
- TglBitmap

## Overview

### Fields

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

### Methods

| `function GetWidth: Integer; virtual;`
| `function GetHeight: Integer; virtual;`
| `procedure SetCustomData(const aValue: Pointer);`
| `procedure SetCustomName(const aValue: String);`
| `procedure SetCustomNameW(const aValue: WideString);`
| `procedure SetDeleteTextureOnFree(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 AfterConstruction; override;`
| `procedure BeforeDestruction; override;`
| `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;`
| `procedure UploadData(const aDataObj: TglBitmapData; const aCheckSize: Boolean = true); virtual;`
| `constructor Create; overload;`
| `constructor Create(const aData: TglBitmapData); overload;`

### Properties

| `property Width: Integer read GetWidth;`
| `property Height: Integer read GetHeight;`
| `property ID: Cardinal read fID write SetID;`
| `property Target: Cardinal read fTarget write SetTarget;`
| `property DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;`
| `property MipMap: TglBitmapMipMap read fMipMap write SetMipMap;`
| `property Anisotropic: Integer read fAnisotropic write SetAnisotropic;`
| `property CustomData: Pointer read fCustomData write SetCustomData;`
| `property CustomName: String read fCustomName write SetCustomName;`
| `property CustomNameW: WideString read fCustomNameW write SetCustomNameW;`
| `property Dimension: TglBitmapSize read fDimension;`

## Description

### Fields

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

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

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

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

| `fAnisotropic: Integer;`
anisotropic level

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

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

| `fDimension: TglBitmapSize;`
size of this texture

| `fMipMap: TglBitmapMipMap;`
mipmap type

| `fCustomData: Pointer;`
user defined data

| `fCustomName: String;`
user defined name

| `fCustomNameW: WideString;`
user defined name

### Methods

| `function GetWidth: Integer; virtual;`

###### Returns

the actual width of the texture

| `function GetHeight: Integer; virtual;`

###### Returns

the actual height of the texture

| `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 SetDeleteTextureOnFree(const aValue: Boolean);`
set new value for fDeleteTextureOnFree

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

| `procedure UploadData(const aDataObj: TglBitmapData; const aCheckSize: Boolean = true); virtual;`

upload texture data from given data object to video card

###### Parameters

aData
  texture data object that contains the actual data
aCheckSize
  check size before upload and throw exception if something is wrong

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

| `constructor Create(const aData: TglBitmapData); overload;`
constructor - creates an texture object and uploads the given data

### Properties

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

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

| `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 DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;`
delete texture object when this object is destroyed

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

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

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

| `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 Dimension: TglBitmapSize read fDimension;`
size of the texture

Generated by PasDoc 0.13.0 on 2014-12-24 04:27:09