Skip to content

Commit

Permalink
ecere/gfx/drivers/OpenGL; Mesh: Fixed GL errors caused by GL_RGBA in …
Browse files Browse the repository at this point in the history
…non-ES
  • Loading branch information
jerstlouis committed Aug 13, 2020
1 parent ddd9a88 commit 71ecf02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions ecere/src/gfx/3D/Mesh.ec
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions ecere/src/gfx/drivers/OpenGLDisplayDriver.ec
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 71ecf02

Please sign in to comment.