Class TglBitmap

DescriptionHierarchyFieldsMethodsProperties

Unit

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

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

Methods

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

Properties

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

Description

Fields

Protected fID: GLuint;

name of the OpenGL texture object

Protected fTarget: GLuint;

texture target (e.g. GL_TEXTURE_2D)

Protected fDeleteTextureOnFree: Boolean;

delete OpenGL texture object when this object is destroyed

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 fAnisotropic: Integer;

anisotropic level

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

color of the texture border

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

color channel swizzle

Protected fDimension: TglBitmapSize;

size of this texture

Protected fMipMap: TglBitmapMipMap;

mipmap type

Protected fCustomData: Pointer;

user defined data

Protected fCustomName: String;

user defined name

Protected fCustomNameW: WideString;

user defined name

Methods

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 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 SetDeleteTextureOnFree(const aValue: Boolean);

set new value for fDeleteTextureOnFree

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

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 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 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
Public constructor Create; overload;

constructor - creates an empty texture

Public constructor Create(const aData: TglBitmapData); overload;

constructor - creates an texture object and uploads the given data

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

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 DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;

delete texture object when this object is destroyed

Public property MipMap: TglBitmapMipMap read fMipMap write SetMipMap;

mipmap type

Public property Anisotropic: Integer read fAnisotropic write SetAnisotropic;

anisotropic level

Public property CustomData: Pointer read fCustomData write SetCustomData;

user defined data (use at will)

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 Dimension: TglBitmapSize read fDimension;

size of the texture


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