From: Mikko Rasa Date: Sun, 9 Feb 2020 21:48:45 +0000 (+0200) Subject: Remove sized L and LA pixel formats X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=0a151ebd17ae98eb145713889887d5070c8a12fb Remove sized L and LA pixel formats These constants are not part of modern OpenGL and not supported on OpenGL ES. The unsized formats can still be used for uploading data and will be translated to RED and RG for use as internal format. --- diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index 547a6a69..dcc6b4ee 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -101,8 +101,6 @@ PixelFormat get_unsized_pixelformat(PixelFormat pf) case RGBA16F: case RGBA32F: return RGBA; case SRGB8_ALPHA8: return SRGB_ALPHA; - case LUMINANCE8: return LUMINANCE; - case LUMINANCE8_ALPHA8: return LUMINANCE_ALPHA; case DEPTH_COMPONENT16: case DEPTH_COMPONENT24: case DEPTH_COMPONENT32: @@ -129,8 +127,6 @@ PixelFormat get_sized_pixelformat(PixelFormat pf, unsigned size) case RGBA: return RGBA8; case SRGB: return SRGB8; case SRGB_ALPHA: return SRGB8_ALPHA8; - case LUMINANCE: return LUMINANCE8; - case LUMINANCE_ALPHA: return LUMINANCE8_ALPHA8; default: throw invalid_argument("get_sized_pixelformat"); } case 2: @@ -222,8 +218,6 @@ unsigned get_component_size(PixelFormat pf) case RGBA8: case SRGB8: case SRGB8_ALPHA8: - case LUMINANCE8: - case LUMINANCE8_ALPHA8: return 1; case R16F: case RG16F: diff --git a/source/pixelformat.h b/source/pixelformat.h index eca0b0e5..377335f2 100644 --- a/source/pixelformat.h +++ b/source/pixelformat.h @@ -47,9 +47,7 @@ enum PixelFormat BGR = GL_BGR, BGRA = GL_BGRA, LUMINANCE = GL_LUMINANCE, - LUMINANCE8 = GL_LUMINANCE8, - LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA, - LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8 + LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA }; void operator>>(const LexicalConverter &, PixelFormat &); diff --git a/source/texture.cpp b/source/texture.cpp index a7e4898c..1452cfbb 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -97,24 +97,24 @@ DataType Texture::get_alloc_type(PixelFormat fmt) void Texture::set_internal_format(PixelFormat fmt) { - if(!get_component_size(fmt) && OES_required_internalformat) - fmt = get_default_sized_pixelformat(fmt); - FormatSwizzle swiz = NO_SWIZZLE; if(ARB_texture_rg && ARB_texture_swizzle) { - if(fmt==LUMINANCE8) + if(fmt==LUMINANCE) { - fmt = R8; + fmt = RED; swiz = R_TO_LUMINANCE; } - else if(fmt==LUMINANCE8_ALPHA8) + else if(fmt==LUMINANCE_ALPHA) { - fmt = RG8; + fmt = RG; swiz = RG_TO_LUMINANCE_ALPHA; } } + if(!get_component_size(fmt) && OES_required_internalformat) + fmt = get_default_sized_pixelformat(fmt); + require_pixelformat(fmt); ifmt = fmt; swizzle = swiz;