mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0032093: Visualization, TKOpenGl - loading texture in BGR format fails in OpenGL ES
Graphic3d_TextureRoot::convertToCompatible() - fixed handling of Image_Format_BGR and Image_Format_BGRA formats. OpenGl_Texture - added error message for unsupported pixel format; error messages have been extended by resource id. OpenGl_Texture::InitCubeMap() now does not release cubemap on mipmaps generation failure. Image_PixMap::ImageFormatToString() - added method returning name of pixel format.
This commit is contained in:
@@ -221,13 +221,20 @@ void Graphic3d_TextureRoot::convertToCompatible (const Handle(Image_SupportedFor
|
||||
return;
|
||||
}
|
||||
|
||||
if ((theImage->Format() == Image_Format_BGR32
|
||||
|| theImage->Format() == Image_Format_BGR32))
|
||||
switch (theImage->Format())
|
||||
{
|
||||
Image_PixMap::SwapRgbaBgra (*theImage);
|
||||
theImage->SetFormat (theImage->Format() == Image_Format_BGR32
|
||||
? Image_Format_RGB32
|
||||
: Image_Format_RGBA);
|
||||
// BGR formats are unsupported in OpenGL ES, only RGB
|
||||
case Image_Format_BGR:
|
||||
Image_PixMap::SwapRgbaBgra (*theImage);
|
||||
theImage->SetFormat (Image_Format_RGB);
|
||||
break;
|
||||
case Image_Format_BGRA:
|
||||
case Image_Format_BGR32:
|
||||
Image_PixMap::SwapRgbaBgra (*theImage);
|
||||
theImage->SetFormat (theImage->Format() == Image_Format_BGR32 ? Image_Format_RGB32 : Image_Format_RGBA);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user