Commit 6056f470 authored by Bergmann89's avatar Bergmann89

* added class function to get format descriptor from given format

* fixed alignment bug in texture data download
parent 821046d4
......@@ -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;
////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -3920,6 +3925,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///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -8427,6 +8440,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');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment