From 71ecf0284cdb5d069f5d879f60396d6867d76a0a Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Thu, 13 Aug 2020 12:44:38 -0400 Subject: [PATCH] ecere/gfx/drivers/OpenGL; Mesh: Fixed GL errors caused by GL_RGBA in non-ES --- ecere/src/gfx/3D/Mesh.ec | 12 ++++++------ ecere/src/gfx/drivers/OpenGLDisplayDriver.ec | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ecere/src/gfx/3D/Mesh.ec b/ecere/src/gfx/3D/Mesh.ec index 2eee1e7117..d6ac749c24 100644 --- a/ecere/src/gfx/3D/Mesh.ec +++ b/ecere/src/gfx/3D/Mesh.ec @@ -1029,14 +1029,14 @@ public: { if(!at->texture) { - int internalFormat = convBitmap.pixelFormat == pixelFormatETC2RGBA8 ? - // TODO: Proper _GLES3 setup... #if !defined(__EMSCRIPTEN__) && ((!defined(_GLES) && !defined(_GLES2)) || defined(_GLES3)) - (/*sRGB2Linear ? GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : */GL_COMPRESSED_RGBA8_ETC2_EAC) : -#else - 0 : + bool sRGB2Linear = bitmap.sRGB2Linear; + int internalFormat = convBitmap.pixelFormat == pixelFormatETC2RGBA8 ? + (sRGB2Linear ? GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : GL_COMPRESSED_RGBA8_ETC2_EAC) : + (sRGB2Linear ? GL_SRGB8_ALPHA8 : GL_RGBA8); + #else + int internalFormat = convBitmap.pixelFormat == pixelFormatETC2RGBA8 ? 0 : GL_RGBA8; #endif - (/*sRGB2Linear ? GL_SRGB8_ALPHA8 : */GL_RGBA); // TOCHECK: Should this be GL_RGBA8 for non-ES? // TOCHECK: Shouldn't the overall bitmap width be set? // Bitmap bmp = convBitmap.bitmaps && convBitmap.numMipMaps ? convBitmap.bitmaps[0] : convBitmap; diff --git a/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec b/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec index 64f8187a2b..855b8add93 100644 --- a/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec +++ b/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec @@ -2173,15 +2173,15 @@ class OpenGLDisplayDriver : DisplayDriver convBitmap = bitmap.ProcessDD(mipMaps, cubeMapFace, false, oglSystem.maxTextureSize, !capabilities.nonPow2Textures); if(convBitmap) { - bool sRGB2Linear = bitmap.sRGB2Linear; - int internalFormat = convBitmap.pixelFormat == pixelFormatETC2RGBA8 ? // TODO: Proper _GLES3 setup... #if !defined(__EMSCRIPTEN__) && ((!defined(_GLES) && !defined(_GLES2)) || defined(_GLES3)) + bool sRGB2Linear = bitmap.sRGB2Linear; + int internalFormat = convBitmap.pixelFormat == pixelFormatETC2RGBA8 ? (sRGB2Linear ? GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : GL_COMPRESSED_RGBA8_ETC2_EAC) : + (sRGB2Linear ? GL_SRGB8_ALPHA8 : GL_RGBA8); #else - 0 : + int internalFormat = convBitmap.pixelFormat == pixelFormatETC2RGBA8 ? 0 : GL_RGBA; #endif - (sRGB2Linear ? GL_SRGB8_ALPHA8 : GL_RGBA); int minFilter = oglSystem.loadingFont ? GL_NEAREST : mipMaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR; int maxFilter = oglSystem.loadingFont ? GL_NEAREST : GL_LINEAR; int face = (cubeMapFace & 7) - 1;