Browse Source

Merge remote-tracking branch 'glBitmap@DGL/unstable'

master
Bergmann89 9 years ago
parent
commit
ba32ba08df
1 changed files with 20 additions and 6 deletions
  1. +20
    -6
      uglcBitmap.pas

+ 20
- 6
uglcBitmap.pas View File

@@ -251,9 +251,9 @@ type
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)
tfRGBA8ub4, //< 1 x unsigned byte (red), 1 x unsigned byte (green), 1 x unsigned byte (blue), 1 x unsigned byte (alpha)
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)
@@ -274,9 +274,9 @@ type
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)
tfBGRA8ub4, //< 1 x unsigned byte (blue), 1 x unsigned byte (green), 1 x unsigned byte (red), 1 x unsigned byte (alpha)
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)
@@ -455,7 +455,12 @@ type
{ get the format descriptor by a given OpenGL internal format
@param aInternalFormat OpenGL internal format to get format descriptor for
@returns suitable format descriptor or tfEmpty-Descriptor }
class function GetByFormat(const aInternalFormat: GLenum): TglBitmapFormatDescriptor;
class function GetByFormat(const aInternalFormat: GLenum): TglBitmapFormatDescriptor; overload;

{ get the format descriptor by the given format
@param aFormat format to get descriptor for
@return suitable format descriptor or tfEmpty-Descriptor }
class function GetByFormat(const aFormat: TglBitmapFormat): TglBitmapFormatDescriptor; overload;
end;

////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1742,9 +1747,9 @@ const
TfdARGB4us1,
TfdRGB5A1us1,
TfdA1RGB5us1,
TfdRGBA8ub4,
TfdRGBA8ui1,
TfdARGB8ui1,
TfdRGBA8ub4,
TfdRGB10A2ui1,
TfdA2RGB10ui1,
TfdRGBA16us4,
@@ -1765,9 +1770,9 @@ const
TfdABGR4us1,
TfdBGR5A1us1,
TfdA1BGR5us1,
TfdBGRA8ub4,
TfdBGRA8ui1,
TfdABGR8ui1,
TfdBGRA8ub4,
TfdBGR10A2ui1,
TfdA2BGR10ui1,
TfdBGRA16us4,
@@ -3070,7 +3075,7 @@ begin
fPrecision := glBitmapRec4ub( 4, 4, 4, 4);
fShift := glBitmapRec4ub(12, 8, 4, 0);
fglFormat := GL_RGBA;
fglInternalFormat := {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}GL_RGBA8{$ELSE}GL_RGBA{$IFEND};
fglInternalFormat := {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}GL_RGBA4{$ELSE}GL_RGBA{$IFEND};
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4;
end;

@@ -3932,6 +3937,14 @@ begin
result := TFormatDescriptor.Get(tfEmpty);
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class function TglBitmapFormatDescriptor.GetByFormat(const aFormat: TglBitmapFormat): TglBitmapFormatDescriptor;
begin
result := TFormatDescriptor.Get(aFormat);
if not Assigned(result) then
result := TFormatDescriptor.Get(tfEmpty);
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TFormatDescriptor///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -8439,6 +8452,7 @@ begin
FormatDesc := TFormatDescriptor.Get(IntFormat);
GetMem(Temp, FormatDesc.GetSize(TempWidth, TempHeight));
try
glPixelStorei(GL_PACK_ALIGNMENT, 1);
if FormatDesc.IsCompressed then begin
if not Assigned(glGetCompressedTexImage) then
raise EglBitmap.Create('compressed formats not supported by video adapter');


Loading…
Cancel
Save