Class TglBitmap2D

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TglBitmap2D = class(TglBitmap)

Description

wrapper class for 2-dimensional textures (OpenGL target = GL_TEXTURE_2D)

Hierarchy

Overview

Fields

Protected fLines: array of PByte;

Methods

Protected function GetScanline(const aIndex: Integer): Pointer;
Protected procedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat; const aWidth: Integer = - 1; const aHeight: Integer = - 1); override;
Protected procedure UploadData(const aTarget: GLenum);
Public procedure AfterConstruction; override;
Public procedure GrabScreen(const aTop, aLeft, aRight, aBottom: Integer; const aFormat: TglBitmapFormat);
Public procedure GenTexture(const aTestTextureSize: Boolean = true); override;
Public function FlipHorz: Boolean; override;
Public function FlipVert: Boolean; override;
Public procedure GenerateNormalMap(const aFunc: TglBitmapNormalMapFunc = nm3x3; const aScale: Single = 2; const aUseAlpha: Boolean = false);

Properties

Public property Width;
Public property Height;
Public property Scanline[constaIndex:Integer]: Pointer read GetScanline;

Description

Fields

Protected fLines: array of PByte;

array to store scanline entry points in

Methods

Protected function GetScanline(const aIndex: Integer): Pointer;

get a specific scanline

Parameters
aIndex
index of the scanline to return
Returns

scanline at position aIndex or Nil

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

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 UploadData(const aTarget: GLenum);

upload the texture data to video card

Parameters
aTarget
target o upload data to (e.g. GL_TEXTURE_2D)
aBuildWithGlu
use glu functions to build mipmaps
Public procedure AfterConstruction; override;

this method is called after constructor and initializes the object

Public procedure GrabScreen(const aTop, aLeft, aRight, aBottom: Integer; const aFormat: TglBitmapFormat);

copy a part of the frame buffer top the texture

Parameters
aTop
topmost pixel to copy
aLeft
leftmost pixel to copy
aRight
rightmost pixel to copy
aBottom
bottommost pixel to copy
aFormat
format to store data in
Public procedure GenTexture(const aTestTextureSize: Boolean = true); override;

generate texture (create texture object if not exist, set texture parameters and upload data)

Parameters
aTestTextureSize
check the size of the texture and throw exception if something is wrong
Public function FlipHorz: Boolean; override;

flip texture horizontally

Returns

True on success, False otherwise

Public function FlipVert: Boolean; override;

flip texture vertically

Returns

True on success, False otherwise

Public procedure GenerateNormalMap(const aFunc: TglBitmapNormalMapFunc = nm3x3; const aScale: Single = 2; const aUseAlpha: Boolean = false);

create normal map from texture data

Parameters
aFunc
normal map function to generate normalmap with
aScale
scale of the normale stored in the normal map
aUseAlpha
generate normalmap from alpha channel data (if present)

Properties

Public property Width;

actual width of the texture

Public property Height;

actual height of the texture

Public property Scanline[constaIndex:Integer]: Pointer read GetScanline;

scanline to access texture data directly


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