X-Git-Url: https://git.delphigl.com/?p=glBitmap.git;a=blobdiff_plain;f=glBitmap.pas;fp=glBitmap.pas;h=638bf0fcdf08e30317d89e278986248b4e5a1ede;hp=165ee38323fc962af1d40d81da95f2e8acdb072d;hb=6056f470e1f9e25aa03f7fe1d3692abc37d3ffd4;hpb=821046d4db90afd95fbbd2c0e1335f58fed38c31 diff --git a/glBitmap.pas b/glBitmap.pas index 165ee38..638bf0f 100644 --- a/glBitmap.pas +++ b/glBitmap.pas @@ -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; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3921,6 +3926,14 @@ begin 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/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class procedure TFormatDescriptor.Init; @@ -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');