From 7d101eb65eeaa37d7a69855b05067fc92f519952 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 21 Feb 2024 19:20:01 +0100 Subject: [PATCH] COpenGLCoreTexture: fix abort when format not supported --- source/Irrlicht/COpenGLCoreTexture.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Irrlicht/COpenGLCoreTexture.h b/source/Irrlicht/COpenGLCoreTexture.h index ceba850a..0fcd06ca 100644 --- a/source/Irrlicht/COpenGLCoreTexture.h +++ b/source/Irrlicht/COpenGLCoreTexture.h @@ -54,6 +54,8 @@ public: KeepImage = Driver->getTextureCreationFlag(ETCF_ALLOW_MEMORY_COPY); getImageValues(images[0]); + if (!InternalFormat) + return; const core::array* tmpImages = &images; @@ -160,6 +162,7 @@ public: if ( !Driver->getColorFormatParameters(ColorFormat, InternalFormat, PixelFormat, PixelType, &Converter) ) { os::Printer::log("COpenGLCoreTexture: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR); + return; } GL.GenTextures(1, &TextureName); @@ -503,7 +506,8 @@ protected: if ( !Driver->getColorFormatParameters(ColorFormat, InternalFormat, PixelFormat, PixelType, &Converter) ) { os::Printer::log("getImageValues: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR); - // not quitting as it will use some alternative internal format + InternalFormat = 0; + return; } if (IImage::isCompressedFormat(image->getColorFormat()))