Skip to content

Commit

Permalink
Fix sRGB texture internal formats in OpenGL ES 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Jan 16, 2022
1 parent 61feb19 commit 65667c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/modules/graphics/opengl/OpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,14 @@ OpenGL::TextureFormat OpenGL::convertPixelFormat(PixelFormat pixelformat, bool r

if (!isPixelFormatCompressed(pixelformat))
{
if (GLAD_ES_VERSION_2_0 && !(GLAD_ES_VERSION_3_0 && pixelformat == PIXELFORMAT_LA8)
// glTexImage in OpenGL ES 2 only accepts internal format enums that
// match the external format. GLES3 doesn't have that restriction -
// except for GL_LUMINANCE_ALPHA which doesn't have a sized version in
// ES3. However we always use RG8 for PIXELFORMAT_LA8 on GLES3 so it
// doesn't matter there.
// Also note that GLES2+extension sRGB format enums are different from
// desktop GL and GLES3+ (this is handled above).
if (GLAD_ES_VERSION_2_0 && !GLAD_ES_VERSION_3_0
&& !renderbuffer && !isTexStorageSupported())
{
f.internalformat = f.externalformat;
Expand Down

0 comments on commit 65667c0

Please sign in to comment.