You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bergmann89 821046d4db * some small OpenGLES fixes 9 years ago
doc * split TglBitmap into TglBitmap and TglBitmapData to be able to handle load, save and convert texture date seperatly from the texture object 9 years ago
examples * added HasOpenGLSupport to FormatDescriptor to check if the given format is supported by OpenGL 9 years ago
glBitmap.pas * some small OpenGLES fixes 9 years ago * moved configuration to seperate inc file 9 years ago
readme.txt * removed some compiler defines 9 years ago


glBitmap by Steffen Xonna aka Lossy eX (2003-2008)

modified by Delphi OpenGL Community ( (2013)

The contents of this project 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
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, ...)

check to configure the glBitmap.pas to fit your needs
- refactoring of the complete library
- glBitmap is managed by git, so this history is not maintenanced any longer
- The define GLB_DELPHI dosn't check versions anymore. If you say you are using delphi
then it's your problem if that isn't true. This prevents the unit for incompatibility
with newer versions of Delphi.
- Problems with D2009+ resolved (Thanks noeska and all i forgot)
- GetPixel isn't set if you are loading textures inside the constructor (Thanks Wilson)
- AddAlphaFromglBitmap used the custom pointer instead the imagedatapointer (Thanks Wilson)
- Additional Datapointer for functioninterface now has the name CustomData
- AssigneAlphaToBitmap overwrites his own palette (Thanks Wilson)
- If you load an texture from an file the property Filename will be set to the name of the file
- Three new properties to attach custom data to the Texture objects
- CustomName (free for use string)
- CustomNameW (free for use widestring)
- CustomDataPointer (free for use pointer to attach other objects or complex structures)
- RLE TGAs loaded much faster
- fixed some problem with reading RLE TGAs.
- function clone now only copys data if it's assigned and now it also copies the ID
- it seems that lazarus dont like comments in comments.
- It's possible to set the id of the texture
- define GLB_NO_NATIVE_GL deactivated by default
- Now supports the following libraries
- SDL and SDL_image
- libPNG
- libJPEG
- Linux compatibillity via free pascal compatibility (delphi sources optional)
- BMPs now loaded manuel
- Large restructuring
- Property DataPtr now has the name Data
- Functions are more flexible between RGB(A) and BGR(A). RGB can be saved as Bitmap and will be saved as BGR
- Unused Depth removed
- Function FreeData to freeing image data added
- ImageID flag of TGAs was ignored. (Thanks Zwoetzen)
- Function SetBorderColor implemented (only used by opengl if wrap is set to GL_CLAMP_TO_BORDER)
- Function AddAlphaFromValue implemented to use an fixed Value as Alphachannel
- Function ReadOpenGLExtension is now only intern
- pngimage now disabled by default like all other versions.
- Setting up an anisotropic filter of 0 isnt allowed by nvidia (Thanks Ogridi)
- Fixed some Problem with Delphi 5
- Now uses the newest version of pngimage. Makes saving pngs much easier.
- Property IsCompressed and Size removed. Not really supported by Spec (Thanks Ogridi)
- Internal Format ifDepth8 added
- function GrabScreen now supports all uncompressed formats
- AddAlphaFromglBitmap implemented
- LoadFromResource and LoadFromResourceId now needs an Instance and an ResourceType (for ID)
- Width, Height and Depth internal changed to TglBitmapPixelPosition.
property Width, Height, Depth are still existing and new property Dimension are avail
- Added native OpenGL Support. Breaking the dglOpenGL "barrier".
- Added function GrabScreen to class TglBitmap2D
- Added support to Save images
- Added function Clone to Clone Instance
- Functions now works with Cardinals for each channel. Up to 32 Bits per channel.
Usefull for Future
- Several speed optimizations
- Internal structure change. Loading of TGA, PNG and DDS improved.
Data, format and size will now set directly with SetDataPtr.
- AddFunc now works with all Types of Images and Formats
- Some Funtions moved to Baseclass TglBitmap
- Added Support to decompress DXT3 and DXT5 compressed Images.
- Added Mapping to convert data from one format into an other.
- Added method ConvertTo in Class TglBitmap2D. Method allows to convert every
supported Input format (supported by GetPixel) into any uncompresed Format
- Added Support to decompress DXT1 compressed Images.
- SwapColors replaced by ConvertTo
- Added Support for compressed DDSs
- Added new internal formats (DXT1, DXT3, DXT5)
- Parameter Components renamed to InternalFormat
- Some AllocMem replaced with GetMem (little speed change)
- better exception handling. Better protection from memory leaks.
- Added support for Direct Draw Surfaces (.DDS) (uncompressed images only)
- Added new internal formats (RGB8, RGBA8, RGBA4, RGB5A1, RGB10A2, R5G6B5)
- Added support for Grayscale textures
- Added internal formats (Alpha, Luminance, LuminanceAlpha, BGR8, BGRA8)
- Added support for GL_VERSION_2_0
- Added support for GL_EXT_texture_filter_anisotropic
- Function FillWithColor fills the Image with one Color
- Function LoadNormalMap added
- ToNormalMap allows to Create an NormalMap from the Alphachannel
- ToNormalMap now supports Sobel (nmSobel) function.
- support for RLE Compressed RGB TGAs added
- Class TglBitmapNormalMap added to support Normalmap generation
- Added function ToNormalMap in class TglBitmap2D to genereate normal maps from textures.
3 Filters are supported. (4 Samples, 3x3 and 5x5)
- Method LoadCubeMapClass removed
- LoadCubeMap returnvalue is now the Texture paramter. Such as LoadTextures
- virtual abstract method GenTexture in class TglBitmap now is protected
- now support DescriptionFlag in LoadTga. Allows vertical flipped images to be loaded as normal
- little enhancement for IsPowerOfTwo
- TglBitmap1D.GenTexture now tests NPOT Textures
- some little name changes. All properties or function with Texture in name are
now without texture in name. We have allways texture so we dosn't name it.
- GenTexture now tests if texture is NPOT and NPOT-Texture are supported or
TextureTarget is GL_TEXTURE_RECTANGLE. Else it raised an exception.
- added support for GL_ARB_texture_rectangle, GL_EXT_texture_rectangle and GL_NV_texture_rectangle
- Function Unbind added
- call of SetFilter or SetTextureWrap if TextureID exists results in setting properties to opengl texture.
- class TglBitmapCubeMap added (allows to Create Cubemaps)
- Added Support for PNG Images. (
To Enable png's use the define pngimage
- New Functioninterface added
- Function GetPixel added
- Property BuildMipMaps renamed to MipMap
- property Name removed.
- BuildMipMaps is now a set of 3 values. None, GluBuildMipmaps and SGIS_generate_mipmap
- property name added. Only used in glForms!
- property FreeDataAfterGenTexture is now available as default (default = true)
- BuildMipmaps now implemented in TglBitmap1D (i've forgotten it)
- function MoveMemory replaced with function Move (little speed change)
- several calculations stored in variables (little speed change)
- property BuildMipsMaps added (default = true)
if BuildMipMaps isn't set GenTextures uses glTexImage[12]D else it use gluBuild[12]dMipmaps
- property FreeDataAfterGenTexture added (default = true)
if FreeDataAfterGenTexture is set the texturedata were deleted after the texture was generated.
- parameter DisableOtherTextureUnits of Bind removed
- parameter FreeDataAfterGeneration of GenTextures removed
- TglBitmap dosn't delete data if class was destroyed (fixed)
- Bind now enables TextureUnits (by params)
- GenTextures can leave data (by param)
- LoadTextures now optimal
- Performance optimization in AddFunc
- procedure Bind moved to subclasses
- Added new Class TglBitmap1D to support real OpenGL 1D Textures
- Texturefilter and texturewrap now also as defaults
Magfilter = GL_LINEAR
Wrap(str) = GL_CLAMP_TO_EDGE
- Added new format tfCompressed to create a compressed texture.
- propertys IsCompressed, TextureSize and IsResident added
IsCompressed and TextureSize only contains data from level 0
- Added function AddFunc to add PerPixelEffects to Image
- LoadFromFunc now based on AddFunc
- Invert now based on AddFunc
- SwapColors now based on AddFunc
- Added function FlipHorz
- Added function LaodFromFunc to create images with function
- Added function FlipVert
- Added internal format RGB(A) if GL_EXT_bgra or OpenGL 1.2 isn't supported
- Added Alphafunctions to calculate alpha per function
- Added Alpha from ColorKey using alphafunctions
- First full functionally Version of glBitmap
- Support for 24Bit and 32Bit TGA Pictures added
- begin of programming