1 glBitmap by Steffen Xonna aka Lossy eX (2003-2008)
2 http://www.opengl24.de/index.php?cat=header&file=glbitmap
4 modified by Delphi OpenGL Community (http://delphigl.com/) (2013)
6 ------------------------------------------------------------
7 The contents of this project are used with permission, subject to
8 the Mozilla Public License Version 1.1 (the "License"); you may
9 not use this file except in compliance with the License. You may
10 obtain a copy of the License at
11 http://www.mozilla.org/MPL/MPL-1.1.html
12 ------------------------------------------------------------
13 The glBitmap is a Delphi/FPC unit that contains several wrapper classes
14 to manage OpenGL texture objects. Below you can find a list of the main
15 functionality of this classes:
16 - load texture data from file (e.g. BMP, TGA, DDS, PNG, JPEG, ...)
17 - load texture data from several other image objects (e.g. TBitmap, TLazIntfImage, SDL Surface)
18 - save texture data to file (e.g. BMP, TGA, DDS, PNG, JPEG, ...)
19 - save texture data to several other image objects (e.g. TBitmap, TLazIntfImage, SDL Surface)
20 - support for many texture formats (e.g. RGB8, BGR8, RGBA8, BGRA8, ...)
21 - manage texture properties (e.g. Filter, Clamp, Mipmap, ...)
22 - upload texture data to video card
23 - download texture data from video card
24 - manipulate texture data (e.g. add alpha, remove alpha, convert to other format, switch RGB, ...)
26 check glBitmapConf.default.inc to configure the glBitmap.pas to fit your needs
27 ------------------------------------------------------------
30 - refactoring of the complete library
31 - glBitmap is managed by git, so this history is not maintenanced any longer
33 - The define GLB_DELPHI dosn't check versions anymore. If you say you are using delphi
34 then it's your problem if that isn't true. This prevents the unit for incompatibility
35 with newer versions of Delphi.
36 - Problems with D2009+ resolved (Thanks noeska and all i forgot)
37 - GetPixel isn't set if you are loading textures inside the constructor (Thanks Wilson)
39 - AddAlphaFromglBitmap used the custom pointer instead the imagedatapointer (Thanks Wilson)
40 - Additional Datapointer for functioninterface now has the name CustomData
42 - AssigneAlphaToBitmap overwrites his own palette (Thanks Wilson)
43 - If you load an texture from an file the property Filename will be set to the name of the file
44 - Three new properties to attach custom data to the Texture objects
45 - CustomName (free for use string)
46 - CustomNameW (free for use widestring)
47 - CustomDataPointer (free for use pointer to attach other objects or complex structures)
49 - RLE TGAs loaded much faster
51 - fixed some problem with reading RLE TGAs.
53 - function clone now only copys data if it's assigned and now it also copies the ID
54 - it seems that lazarus dont like comments in comments.
56 - It's possible to set the id of the texture
57 - define GLB_NO_NATIVE_GL deactivated by default
59 - Now supports the following libraries
63 - Linux compatibillity via free pascal compatibility (delphi sources optional)
64 - BMPs now loaded manuel
66 - Property DataPtr now has the name Data
67 - Functions are more flexible between RGB(A) and BGR(A). RGB can be saved as Bitmap and will be saved as BGR
68 - Unused Depth removed
69 - Function FreeData to freeing image data added
71 - ImageID flag of TGAs was ignored. (Thanks Zwoetzen)
73 - Function SetBorderColor implemented (only used by opengl if wrap is set to GL_CLAMP_TO_BORDER)
74 - Function AddAlphaFromValue implemented to use an fixed Value as Alphachannel
75 - Function ReadOpenGLExtension is now only intern
77 - pngimage now disabled by default like all other versions.
79 - Setting up an anisotropic filter of 0 isnt allowed by nvidia (Thanks Ogridi)
81 - Fixed some Problem with Delphi 5
82 - Now uses the newest version of pngimage. Makes saving pngs much easier.
84 - Property IsCompressed and Size removed. Not really supported by Spec (Thanks Ogridi)
86 - Internal Format ifDepth8 added
87 - function GrabScreen now supports all uncompressed formats
89 - AddAlphaFromglBitmap implemented
91 - LoadFromResource and LoadFromResourceId now needs an Instance and an ResourceType (for ID)
93 - Width, Height and Depth internal changed to TglBitmapPixelPosition.
94 property Width, Height, Depth are still existing and new property Dimension are avail
96 - Added native OpenGL Support. Breaking the dglOpenGL "barrier".
98 - Added function GrabScreen to class TglBitmap2D
100 - Added support to Save images
101 - Added function Clone to Clone Instance
103 - Functions now works with Cardinals for each channel. Up to 32 Bits per channel.
105 - Several speed optimizations
107 - Internal structure change. Loading of TGA, PNG and DDS improved.
108 Data, format and size will now set directly with SetDataPtr.
109 - AddFunc now works with all Types of Images and Formats
110 - Some Funtions moved to Baseclass TglBitmap
112 - Added Support to decompress DXT3 and DXT5 compressed Images.
113 - Added Mapping to convert data from one format into an other.
115 - Added method ConvertTo in Class TglBitmap2D. Method allows to convert every
116 supported Input format (supported by GetPixel) into any uncompresed Format
117 - Added Support to decompress DXT1 compressed Images.
118 - SwapColors replaced by ConvertTo
120 - Added Support for compressed DDSs
121 - Added new internal formats (DXT1, DXT3, DXT5)
123 - Parameter Components renamed to InternalFormat
125 - Some AllocMem replaced with GetMem (little speed change)
126 - better exception handling. Better protection from memory leaks.
128 - Added support for Direct Draw Surfaces (.DDS) (uncompressed images only)
129 - Added new internal formats (RGB8, RGBA8, RGBA4, RGB5A1, RGB10A2, R5G6B5)
131 - Added support for Grayscale textures
132 - Added internal formats (Alpha, Luminance, LuminanceAlpha, BGR8, BGRA8)
134 - Added support for GL_VERSION_2_0
135 - Added support for GL_EXT_texture_filter_anisotropic
137 - Function FillWithColor fills the Image with one Color
138 - Function LoadNormalMap added
140 - ToNormalMap allows to Create an NormalMap from the Alphachannel
141 - ToNormalMap now supports Sobel (nmSobel) function.
143 - support for RLE Compressed RGB TGAs added
145 - Class TglBitmapNormalMap added to support Normalmap generation
146 - Added function ToNormalMap in class TglBitmap2D to genereate normal maps from textures.
147 3 Filters are supported. (4 Samples, 3x3 and 5x5)
149 - Method LoadCubeMapClass removed
150 - LoadCubeMap returnvalue is now the Texture paramter. Such as LoadTextures
151 - virtual abstract method GenTexture in class TglBitmap now is protected
153 - now support DescriptionFlag in LoadTga. Allows vertical flipped images to be loaded as normal
155 - little enhancement for IsPowerOfTwo
156 - TglBitmap1D.GenTexture now tests NPOT Textures
158 - some little name changes. All properties or function with Texture in name are
159 now without texture in name. We have allways texture so we dosn't name it.
161 - GenTexture now tests if texture is NPOT and NPOT-Texture are supported or
162 TextureTarget is GL_TEXTURE_RECTANGLE. Else it raised an exception.
164 - added support for GL_ARB_texture_rectangle, GL_EXT_texture_rectangle and GL_NV_texture_rectangle
166 - Function Unbind added
167 - call of SetFilter or SetTextureWrap if TextureID exists results in setting properties to opengl texture.
169 - class TglBitmapCubeMap added (allows to Create Cubemaps)
171 - Added Support for PNG Images. (http://pngdelphi.sourceforge.net/)
172 To Enable png's use the define pngimage
174 - New Functioninterface added
175 - Function GetPixel added
177 - Property BuildMipMaps renamed to MipMap
179 - property Name removed.
180 - BuildMipMaps is now a set of 3 values. None, GluBuildMipmaps and SGIS_generate_mipmap
182 - property name added. Only used in glForms!
184 - property FreeDataAfterGenTexture is now available as default (default = true)
185 - BuildMipmaps now implemented in TglBitmap1D (i've forgotten it)
186 - function MoveMemory replaced with function Move (little speed change)
187 - several calculations stored in variables (little speed change)
189 - property BuildMipsMaps added (default = true)
190 if BuildMipMaps isn't set GenTextures uses glTexImage[12]D else it use gluBuild[12]dMipmaps
191 - property FreeDataAfterGenTexture added (default = true)
192 if FreeDataAfterGenTexture is set the texturedata were deleted after the texture was generated.
193 - parameter DisableOtherTextureUnits of Bind removed
194 - parameter FreeDataAfterGeneration of GenTextures removed
196 - TglBitmap dosn't delete data if class was destroyed (fixed)
198 - Bind now enables TextureUnits (by params)
199 - GenTextures can leave data (by param)
200 - LoadTextures now optimal
202 - Performance optimization in AddFunc
203 - procedure Bind moved to subclasses
204 - Added new Class TglBitmap1D to support real OpenGL 1D Textures
206 - Texturefilter and texturewrap now also as defaults
207 Minfilter = GL_LINEAR_MIPMAP_LINEAR
208 Magfilter = GL_LINEAR
209 Wrap(str) = GL_CLAMP_TO_EDGE
210 - Added new format tfCompressed to create a compressed texture.
211 - propertys IsCompressed, TextureSize and IsResident added
212 IsCompressed and TextureSize only contains data from level 0
214 - Added function AddFunc to add PerPixelEffects to Image
215 - LoadFromFunc now based on AddFunc
216 - Invert now based on AddFunc
217 - SwapColors now based on AddFunc
219 - Added function FlipHorz
221 - Added function LaodFromFunc to create images with function
222 - Added function FlipVert
223 - Added internal format RGB(A) if GL_EXT_bgra or OpenGL 1.2 isn't supported
225 - Added Alphafunctions to calculate alpha per function
226 - Added Alpha from ColorKey using alphafunctions
228 - First full functionally Version of glBitmap
229 - Support for 24Bit and 32Bit TGA Pictures added
231 - begin of programming