|
|
@@ -998,6 +998,12 @@ type |
|
|
|
procedure SetAnisotropic(const aValue: Integer); |
|
|
|
|
|
|
|
protected |
|
|
|
{ initialize variables } |
|
|
|
procedure Init; virtual; |
|
|
|
|
|
|
|
{ finalize variables } |
|
|
|
procedure Finish; virtual; |
|
|
|
|
|
|
|
{ create OpenGL texture object (delete exisiting object if exists) } |
|
|
|
procedure CreateID; |
|
|
|
|
|
|
@@ -1025,12 +1031,6 @@ type |
|
|
|
property IsResident: GLboolean read fIsResident; //< @true if OpenGL texture object has data, @false otherwise |
|
|
|
{$ENDIF} |
|
|
|
|
|
|
|
{ this method is called after the constructor and sets the default values of this object } |
|
|
|
procedure AfterConstruction; override; |
|
|
|
|
|
|
|
{ this method is called before the destructor and does some cleanup } |
|
|
|
procedure BeforeDestruction; override; |
|
|
|
|
|
|
|
public |
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
{ set the new value for texture border color |
|
|
@@ -1091,6 +1091,8 @@ type |
|
|
|
{ constructor - creates an texture object and uploads the given data } |
|
|
|
constructor Create(const aData: TglBitmapData); overload; |
|
|
|
|
|
|
|
{ destructor } |
|
|
|
destructor Destroy; override; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
@@ -1099,6 +1101,8 @@ type |
|
|
|
all operations on a bitmap object must be done from the render thread } |
|
|
|
TglBitmap1D = class(TglBitmap) |
|
|
|
protected |
|
|
|
{ this method is called after constructor and initializes the object } |
|
|
|
procedure Init; override; |
|
|
|
|
|
|
|
{ upload the texture data to video card |
|
|
|
@param aDataObj texture data object that contains the actual data |
|
|
@@ -1108,9 +1112,6 @@ type |
|
|
|
public |
|
|
|
property Width; //< actual with of the texture |
|
|
|
|
|
|
|
{ this method is called after constructor and initializes the object } |
|
|
|
procedure AfterConstruction; override; |
|
|
|
|
|
|
|
{ upload texture data from given data object to video card |
|
|
|
@param aData texture data object that contains the actual data |
|
|
|
@param aCheckSize check size before upload and throw exception if something is wrong } |
|
|
@@ -1124,6 +1125,8 @@ type |
|
|
|
all operations on a bitmap object must be done from the render thread } |
|
|
|
TglBitmap2D = class(TglBitmap) |
|
|
|
protected |
|
|
|
{ this method is called after constructor and initializes the object } |
|
|
|
procedure Init; override; |
|
|
|
|
|
|
|
{ upload the texture data to video card |
|
|
|
@param aDataObj texture data object that contains the actual data |
|
|
@@ -1136,9 +1139,6 @@ type |
|
|
|
property Width; //< actual width of the texture |
|
|
|
property Height; //< actual height of the texture |
|
|
|
|
|
|
|
{ this method is called after constructor and initializes the object } |
|
|
|
procedure AfterConstruction; override; |
|
|
|
|
|
|
|
{ upload texture data from given data object to video card |
|
|
|
@param aData texture data object that contains the actual data |
|
|
|
@param aCheckSize check size before upload and throw exception if something is wrong } |
|
|
@@ -1167,9 +1167,10 @@ type |
|
|
|
fGenMode: Integer; //< generation mode for the cube map (e.g. GL_REFLECTION_MAP) |
|
|
|
{$ENDIF} |
|
|
|
|
|
|
|
public |
|
|
|
{ this method is called after constructor and initializes the object } |
|
|
|
procedure AfterConstruction; override; |
|
|
|
procedure Init; override; |
|
|
|
|
|
|
|
public |
|
|
|
|
|
|
|
{ upload texture data from given data object to video card |
|
|
|
@param aData texture data object that contains the actual data |
|
|
@@ -1201,7 +1202,7 @@ type |
|
|
|
TglBitmapNormalMap = class(TglBitmapCubeMap) |
|
|
|
public |
|
|
|
{ this method is called after constructor and initializes the object } |
|
|
|
procedure AfterConstruction; override; |
|
|
|
procedure Init; override; |
|
|
|
|
|
|
|
{ create cube normal map from texture data and upload it to video card |
|
|
|
@param aSize size of each cube map texture |
|
|
@@ -8150,6 +8151,32 @@ begin |
|
|
|
end; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap.Init; |
|
|
|
begin |
|
|
|
fID := 0; |
|
|
|
fTarget := 0; |
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
fIsResident := false; |
|
|
|
{$ENDIF} |
|
|
|
|
|
|
|
fMipMap := glBitmapDefaultMipmap; |
|
|
|
fDeleteTextureOnFree := glBitmapGetDefaultDeleteTextureOnFree; |
|
|
|
|
|
|
|
glBitmapGetDefaultFilter (fFilterMin, fFilterMag); |
|
|
|
glBitmapGetDefaultTextureWrap(fWrapS, fWrapT, fWrapR); |
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
glBitmapGetDefaultSwizzle (fSwizzle[0], fSwizzle[1], fSwizzle[2], fSwizzle[3]); |
|
|
|
{$ENDIF} |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap.Finish; |
|
|
|
begin |
|
|
|
if (fID > 0) and fDeleteTextureOnFree then |
|
|
|
glDeleteTextures(1, @fID); |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap.CreateID; |
|
|
|
begin |
|
|
@@ -8191,35 +8218,6 @@ end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
//TglBitmap - PUBLIC////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap.AfterConstruction; |
|
|
|
begin |
|
|
|
inherited AfterConstruction; |
|
|
|
|
|
|
|
fID := 0; |
|
|
|
fTarget := 0; |
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
fIsResident := false; |
|
|
|
{$ENDIF} |
|
|
|
|
|
|
|
fMipMap := glBitmapDefaultMipmap; |
|
|
|
fDeleteTextureOnFree := glBitmapGetDefaultDeleteTextureOnFree; |
|
|
|
|
|
|
|
glBitmapGetDefaultFilter (fFilterMin, fFilterMag); |
|
|
|
glBitmapGetDefaultTextureWrap(fWrapS, fWrapT, fWrapR); |
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
glBitmapGetDefaultSwizzle (fSwizzle[0], fSwizzle[1], fSwizzle[2], fSwizzle[3]); |
|
|
|
{$ENDIF} |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap.BeforeDestruction; |
|
|
|
begin |
|
|
|
if (fID > 0) and fDeleteTextureOnFree then |
|
|
|
glDeleteTextures(1, @fID); |
|
|
|
inherited BeforeDestruction; |
|
|
|
end; |
|
|
|
|
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap.SetBorderColor(const aRed, aGreen, aBlue, aAlpha: Single); |
|
|
@@ -8475,6 +8473,7 @@ begin |
|
|
|
if (ClassType = TglBitmap) then |
|
|
|
raise EglBitmap.Create('Don''t create TglBitmap directly. Use one of the deviated classes (TglBitmap2D) instead.'); |
|
|
|
inherited Create; |
|
|
|
Init; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
@@ -8484,9 +8483,23 @@ begin |
|
|
|
UploadData(aData); |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
destructor TglBitmap.Destroy; |
|
|
|
begin |
|
|
|
Finish; |
|
|
|
inherited Destroy; |
|
|
|
end; |
|
|
|
|
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
//TglBitmap1D///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap1D.Init; |
|
|
|
begin |
|
|
|
inherited; |
|
|
|
Target := GL_TEXTURE_1D; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap1D.UploadDataIntern(const aDataObj: TglBitmapData; const aBuildWithGlu: Boolean); |
|
|
|
var |
|
|
@@ -8507,13 +8520,6 @@ begin |
|
|
|
glTexImage1D(Target, 0, fd.glInternalFormat, aDataObj.Width, 0, fd.glFormat, fd.glDataFormat, aDataObj.Data); |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap1D.AfterConstruction; |
|
|
|
begin |
|
|
|
inherited; |
|
|
|
Target := GL_TEXTURE_1D; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap1D.UploadData(const aDataObj: TglBitmapData; const aCheckSize: Boolean); |
|
|
|
var |
|
|
@@ -8548,6 +8554,13 @@ end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
//TglBitmap2D///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap2D.Init; |
|
|
|
begin |
|
|
|
inherited; |
|
|
|
Target := GL_TEXTURE_2D; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap2D.UploadDataIntern(const aDataObj: TglBitmapData; const aTarget: GLenum{$IFNDEF OPENGL_ES}; const aBuildWithGlu: Boolean{$ENDIF}); |
|
|
|
var |
|
|
@@ -8572,13 +8585,6 @@ begin |
|
|
|
end; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap2D.AfterConstruction; |
|
|
|
begin |
|
|
|
inherited; |
|
|
|
Target := GL_TEXTURE_2D; |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmap2D.UploadData(const aDataObj: TglBitmapData; const aCheckSize: Boolean); |
|
|
|
var |
|
|
@@ -8654,16 +8660,16 @@ end; |
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
//TglBitmapCubeMap//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmapCubeMap.AfterConstruction; |
|
|
|
procedure TglBitmapCubeMap.Init; |
|
|
|
begin |
|
|
|
inherited; |
|
|
|
|
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|
if not (GL_VERSION_1_3 or GL_ARB_texture_cube_map or GL_EXT_texture_cube_map) then |
|
|
|
raise EglBitmap.Create('TglBitmapCubeMap.AfterConstruction - CubeMaps are unsupported.'); |
|
|
|
raise EglBitmap.Create('TglBitmapCubeMap.Init - CubeMaps are unsupported.'); |
|
|
|
{$ELSE} |
|
|
|
if not (GL_VERSION_2_0) then |
|
|
|
raise EglBitmap.Create('TglBitmapCubeMap.AfterConstruction - CubeMaps are unsupported.'); |
|
|
|
raise EglBitmap.Create('TglBitmapCubeMap.Init - CubeMaps are unsupported.'); |
|
|
|
{$ENDIF} |
|
|
|
|
|
|
|
SetWrap; |
|
|
@@ -8837,7 +8843,7 @@ begin |
|
|
|
end; |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
procedure TglBitmapNormalMap.AfterConstruction; |
|
|
|
procedure TglBitmapNormalMap.Init; |
|
|
|
begin |
|
|
|
inherited; |
|
|
|
{$IFNDEF OPENGL_ES} |
|
|
|