Unit glBitmap

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

glBitmap by Steffen Xonna aka Lossy eX (2003-2008) http://www.opengl24.de/index.php?cat=header&file=glbitmap

modified by Delphi OpenGL Community (http://delphigl.com/) (2013)

The contents of this file are used with permission, subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html

The glBitmap is a Delphi/FPC unit that contains several wrapper classes to manage OpenGL texture objects. Below you can find a list of the main functionality of this classes: - load texture data from file (e.g. BMP, TGA, DDS, PNG, JPEG, ...) - load texture data from several other image objects (e.g. TBitmap, TLazIntfImage, SDL Surface) - save texture data to file (e.g. BMP, TGA, DDS, PNG, JPEG, ...) - save texture data to several other image objects (e.g. TBitmap, TLazIntfImage, SDL Surface) - support for many texture formats (e.g. RGB8, BGR8, RGBA8, BGRA8, ...) - manage texture properties (e.g. Filter, Clamp, Mipmap, ...) - upload texture data to video card - download texture data from video card - manipulate texture data (e.g. add alpha, remove alpha, convert to other format, switch RGB, ...)

Overview

Classes, Interfaces, Objects and Records

Name Description
Class EglBitmap  
Class EglBitmapNotSupported  
Class EglBitmapSizeToLarge  
Class EglBitmapNonPowerOfTwo  
Class EglBitmapUnsupportedFormat  
packed record TglBitmapRec4ui  
packed record TglBitmapRec4ub  
packed record TglBitmapRec4ul  
Class TglBitmapFormatDescriptor  
packed record TglBitmapPixelData  
packed record TglBitmapSize  
record TglBitmapFunctionRec  
Class TglBitmap  
Class TglBitmap1D  
Class TglBitmap2D  
Class TglBitmapCubeMap  
Class TglBitmapNormalMap  

Functions and Procedures

procedure glBitmapSetDefaultDeleteTextureOnFree(const aDeleteTextureOnFree: Boolean);
procedure glBitmapSetDefaultFreeDataAfterGenTexture(const aFreeData: Boolean);
procedure glBitmapSetDefaultMipmap(const aValue: TglBitmapMipMap);
procedure glBitmapSetDefaultFormat(const aFormat: TglBitmapFormat);
procedure glBitmapSetDefaultFilter(const aMin, aMag: Integer);
procedure glBitmapSetDefaultWrap( const S: Cardinal = GL_CLAMP_TO_EDGE; const T: Cardinal = GL_CLAMP_TO_EDGE; const R: Cardinal = GL_CLAMP_TO_EDGE);
procedure glBitmapSetDefaultSwizzle(const r: GLenum = GL_RED; g: GLenum = GL_GREEN; b: GLenum = GL_BLUE; a: GLenum = GL_ALPHA);
function glBitmapGetDefaultDeleteTextureOnFree: Boolean;
function glBitmapGetDefaultFreeDataAfterGenTexture: Boolean;
function glBitmapGetDefaultMipmap: TglBitmapMipMap;
function glBitmapGetDefaultFormat: TglBitmapFormat;
procedure glBitmapGetDefaultFilter(var aMin, aMag: Cardinal);
procedure glBitmapGetDefaultTextureWrap(var S, T, R: Cardinal);
procedure glBitmapGetDefaultSwizzle(var r, g, b, a: GLenum);
function glBitmapSize(X: Integer = -1; Y: Integer = -1): TglBitmapSize;
function glBitmapPosition(X: Integer = -1; Y: Integer = -1): TglBitmapPixelPosition;
function glBitmapRec4ub(const r, g, b, a: Byte): TglBitmapRec4ub;
function glBitmapRec4ui(const r, g, b, a: Cardinal): TglBitmapRec4ui;
function glBitmapRec4ul(const r, g, b, a: QWord): TglBitmapRec4ul;
function glBitmapRec4ubCompare(const r1, r2: TglBitmapRec4ub): Boolean;
function glBitmapRec4uiCompare(const r1, r2: TglBitmapRec4ui): Boolean;
function glBitmapCreateTestTexture(const aFormat: TglBitmapFormat): TglBitmap2D;

Types

TglBitmapFormat = (...);
TglBitmapFileType = (...);
TglBitmapFileTypes = set of TglBitmapFileType;
TglBitmapMipMap = (...);
TglBitmapNormalMapFunc = (...);
PglBitmapPixelData = ˆTglBitmapPixelData;
TglBitmapSizeFields = set of (ffX, ffY);
TglBitmapPixelPosition = TglBitmapSize;
TglBitmapFunction = procedure(var FuncRec: TglBitmapFunctionRec);

Constants

NULL_SIZE: TglBitmapSize = (Fields: []; X: 0; Y: 0);

Description

Functions and Procedures

procedure glBitmapSetDefaultDeleteTextureOnFree(const aDeleteTextureOnFree: Boolean);
 
procedure glBitmapSetDefaultFreeDataAfterGenTexture(const aFreeData: Boolean);
 
procedure glBitmapSetDefaultMipmap(const aValue: TglBitmapMipMap);
 
procedure glBitmapSetDefaultFormat(const aFormat: TglBitmapFormat);
 
procedure glBitmapSetDefaultFilter(const aMin, aMag: Integer);
 
procedure glBitmapSetDefaultWrap( const S: Cardinal = GL_CLAMP_TO_EDGE; const T: Cardinal = GL_CLAMP_TO_EDGE; const R: Cardinal = GL_CLAMP_TO_EDGE);
 
procedure glBitmapSetDefaultSwizzle(const r: GLenum = GL_RED; g: GLenum = GL_GREEN; b: GLenum = GL_BLUE; a: GLenum = GL_ALPHA);
 
function glBitmapGetDefaultDeleteTextureOnFree: Boolean;
 
function glBitmapGetDefaultFreeDataAfterGenTexture: Boolean;
 
function glBitmapGetDefaultMipmap: TglBitmapMipMap;
 
function glBitmapGetDefaultFormat: TglBitmapFormat;
 
procedure glBitmapGetDefaultFilter(var aMin, aMag: Cardinal);
 
procedure glBitmapGetDefaultTextureWrap(var S, T, R: Cardinal);
 
procedure glBitmapGetDefaultSwizzle(var r, g, b, a: GLenum);
 
function glBitmapSize(X: Integer = -1; Y: Integer = -1): TglBitmapSize;
 
function glBitmapPosition(X: Integer = -1; Y: Integer = -1): TglBitmapPixelPosition;
 
function glBitmapRec4ub(const r, g, b, a: Byte): TglBitmapRec4ub;
 
function glBitmapRec4ui(const r, g, b, a: Cardinal): TglBitmapRec4ui;
 
function glBitmapRec4ul(const r, g, b, a: QWord): TglBitmapRec4ul;
 
function glBitmapRec4ubCompare(const r1, r2: TglBitmapRec4ub): Boolean;
 
function glBitmapRec4uiCompare(const r1, r2: TglBitmapRec4ui): Boolean;
 
function glBitmapCreateTestTexture(const aFormat: TglBitmapFormat): TglBitmap2D;
 

Types

TglBitmapFormat = (...);

type that describes the format of the data stored in a texture. the name of formats is composed of the following constituents: - multiple channels: - channel (e.g. R, G, B, A or Alpha, Luminance or X (reserved)) - width of the chanel in bit (4, 8, 16, ...) - data type (e.g. ub, us, ui) - number of elements of data types

Values
  • tfEmpty = 0:  
  • tfAlpha4ub1: 1 x unsigned byte
  • tfAlpha8ub1: 1 x unsigned byte
  • tfAlpha16us1: 1 x unsigned short
  • tfLuminance4ub1: 1 x unsigned byte
  • tfLuminance8ub1: 1 x unsigned byte
  • tfLuminance16us1: 1 x unsigned short
  • tfLuminance4Alpha4ub2: 1 x unsigned byte (lum), 1 x unsigned byte (alpha)
  • tfLuminance6Alpha2ub2: 1 x unsigned byte (lum), 1 x unsigned byte (alpha)
  • tfLuminance8Alpha8ub2: 1 x unsigned byte (lum), 1 x unsigned byte (alpha)
  • tfLuminance12Alpha4us2: 1 x unsigned short (lum), 1 x unsigned short (alpha)
  • tfLuminance16Alpha16us2: 1 x unsigned short (lum), 1 x unsigned short (alpha)
  • tfR3G3B2ub1: 1 x unsigned byte (3bit red, 3bit green, 2bit blue)
  • tfRGBX4us1: 1 x unsigned short (4bit red, 4bit green, 4bit blue, 4bit reserverd)
  • tfXRGB4us1: 1 x unsigned short (4bit reserved, 4bit red, 4bit green, 4bit blue)
  • tfR5G6B5us1: 1 x unsigned short (5bit red, 6bit green, 5bit blue)
  • tfRGB5X1us1: 1 x unsigned short (5bit red, 5bit green, 5bit blue, 1bit reserved)
  • tfX1RGB5us1: 1 x unsigned short (1bit reserved, 5bit red, 5bit green, 5bit blue)
  • tfRGB8ub3: 1 x unsigned byte (red), 1 x unsigned byte (green), 1 x unsigned byte (blue)
  • tfRGBX8ui1: 1 x unsigned int (8bit red, 8bit green, 8bit blue, 8bit reserved)
  • tfXRGB8ui1: 1 x unsigned int (8bit reserved, 8bit red, 8bit green, 8bit blue)
  • tfRGB10X2ui1: 1 x unsigned int (10bit red, 10bit green, 10bit blue, 2bit reserved)
  • tfX2RGB10ui1: 1 x unsigned int (2bit reserved, 10bit red, 10bit green, 10bit blue)
  • tfRGB16us3: 1 x unsigned short (red), 1 x unsigned short (green), 1 x unsigned short (blue)
  • tfRGBA4us1: 1 x unsigned short (4bit red, 4bit green, 4bit blue, 4bit alpha)
  • tfARGB4us1: 1 x unsigned short (4bit alpha, 4bit red, 4bit green, 4bit blue)
  • tfRGB5A1us1: 1 x unsigned short (5bit red, 5bit green, 5bit blue, 1bit alpha)
  • tfA1RGB5us1: 1 x unsigned short (1bit alpha, 5bit red, 5bit green, 5bit blue)
  • tfRGBA8ui1: 1 x unsigned int (8bit red, 8bit green, 8bit blue, 8 bit alpha)
  • tfARGB8ui1: 1 x unsigned int (8 bit alpha, 8bit red, 8bit green, 8bit blue)
  • tfRGBA8ub4: 1 x unsigned byte (red), 1 x unsigned byte (green), 1 x unsigned byte (blue), 1 x unsigned byte (alpha)
  • tfRGB10A2ui1: 1 x unsigned int (10bit red, 10bit green, 10bit blue, 2bit alpha)
  • tfA2RGB10ui1: 1 x unsigned int (2bit alpha, 10bit red, 10bit green, 10bit blue)
  • tfRGBA16us4: 1 x unsigned short (red), 1 x unsigned short (green), 1 x unsigned short (blue), 1 x unsigned short (alpha)
  • tfBGRX4us1: 1 x unsigned short (4bit blue, 4bit green, 4bit red, 4bit reserved)
  • tfXBGR4us1: 1 x unsigned short (4bit reserved, 4bit blue, 4bit green, 4bit red)
  • tfB5G6R5us1: 1 x unsigned short (5bit blue, 6bit green, 5bit red)
  • tfBGR5X1us1: 1 x unsigned short (5bit blue, 5bit green, 5bit red, 1bit reserved)
  • tfX1BGR5us1: 1 x unsigned short (1bit reserved, 5bit blue, 5bit green, 5bit red)
  • tfBGR8ub3: 1 x unsigned byte (blue), 1 x unsigned byte (green), 1 x unsigned byte (red)
  • tfBGRX8ui1: 1 x unsigned int (8bit blue, 8bit green, 8bit red, 8bit reserved)
  • tfXBGR8ui1: 1 x unsigned int (8bit reserved, 8bit blue, 8bit green, 8bit red)
  • tfBGR10X2ui1: 1 x unsigned int (10bit blue, 10bit green, 10bit red, 2bit reserved)
  • tfX2BGR10ui1: 1 x unsigned int (2bit reserved, 10bit blue, 10bit green, 10bit red)
  • tfBGR16us3: 1 x unsigned short (blue), 1 x unsigned short (green), 1 x unsigned short (red)
  • tfBGRA4us1: 1 x unsigned short (4bit blue, 4bit green, 4bit red, 4bit alpha)
  • tfABGR4us1: 1 x unsigned short (4bit alpha, 4bit blue, 4bit green, 4bit red)
  • tfBGR5A1us1: 1 x unsigned short (5bit blue, 5bit green, 5bit red, 1bit alpha)
  • tfA1BGR5us1: 1 x unsigned short (1bit alpha, 5bit blue, 5bit green, 5bit red)
  • tfBGRA8ui1: 1 x unsigned int (8bit blue, 8bit green, 8bit red, 8bit alpha)
  • tfABGR8ui1: 1 x unsigned int (8bit alpha, 8bit blue, 8bit green, 8bit red)
  • tfBGRA8ub4: 1 x unsigned byte (blue), 1 x unsigned byte (green), 1 x unsigned byte (red), 1 x unsigned byte (alpha)
  • tfBGR10A2ui1: 1 x unsigned int (10bit blue, 10bit green, 10bit red, 2bit alpha)
  • tfA2BGR10ui1: 1 x unsigned int (2bit alpha, 10bit blue, 10bit green, 10bit red)
  • tfBGRA16us4: 1 x unsigned short (blue), 1 x unsigned short (green), 1 x unsigned short (red), 1 x unsigned short (alpha)
  • tfDepth16us1: 1 x unsigned short (depth)
  • tfDepth24ui1: 1 x unsigned int (depth)
  • tfDepth32ui1: 1 x unsigned int (depth)
  • tfS3tcDtx1RGBA:  
  • tfS3tcDtx3RGBA:  
  • tfS3tcDtx5RGBA:  
TglBitmapFileType = (...);

Portable Network Graphic file (PNG)

Values
  • ftDDS: Direct Draw Surface file (DDS)
  • ftTGA: Targa Image File (TGA)
  • ftBMP: Windows Bitmap File (BMP)
  • ftRAW: glBitmap RAW file format
TglBitmapFileTypes = set of TglBitmapFileType;
 
TglBitmapMipMap = (...);

possible mipmap types

Values
  • mmNone: no mipmaps
  • mmMipmap: normal mipmaps
  • mmMipmapGlu: mipmaps generated with glu functions
TglBitmapNormalMapFunc = (...);

possible normal map functions

Values
  • nm4Samples:  
  • nmSobel:  
  • nm3x3:  
  • nm5x5:  
PglBitmapPixelData = ˆTglBitmapPixelData;
 
TglBitmapSizeFields = set of (ffX, ffY);
 
TglBitmapPixelPosition = TglBitmapSize;
 
TglBitmapFunction = procedure(var FuncRec: TglBitmapFunctionRec);

callback to use for converting texture data

Constants

NULL_SIZE: TglBitmapSize = (Fields: []; X: 0; Y: 0);
 

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