From 00cc00311b96640230656a92e764106e0bc500b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 15 Sep 2012 11:28:57 +0200 Subject: [PATCH] Workarounds for old GLEW versions (tested on 1.6). GLEW defines some extensions on its own and is making mistakes, which aren't later resolved by including the official header, because the extension is already defined in glew.h. Hopefully these are the first and last errors found. --- src/AbstractTexture.h | 18 ++++++++++++++---- src/Renderbuffer.h | 5 +++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index ed3e365a3..32b0900fd 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -330,11 +330,15 @@ class MAGNUM_EXPORT AbstractTexture { */ RG11B10Float = GL_R11F_G11F_B10F, + /* 1.5.6 <= GLEW < 1.8.0 doesn't have this, even if there is + GL_ARB_ES2_compatibility */ + #if defined(GL_RGB565) || defined(DOXYGEN_GENERATING_OUTPUT) /** * Three-component RGB, unsigned normalized, red and blue 5bit, * green 6bit, 16bit total. */ RGB565 = GL_RGB565, + #endif /** * Three-component RGB, unsigned with exponent, each component @@ -399,33 +403,39 @@ class MAGNUM_EXPORT AbstractTexture { */ CompressedRtgcSignedRedGreen = GL_COMPRESSED_SIGNED_RG_RGTC2, + /* These are named with _ARB suffix, because glcorearb.h doesn't + have suffixless version (?!) and GLEW has it without suffix as + late as of 1.8.0 { */ + /** * BPTC compressed RGBA, unsigned normalized. * @requires_gl * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} */ - CompressedBptcRGBA = GL_COMPRESSED_RGBA_BPTC_UNORM, + CompressedBptcRGBA = GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, /** * BPTC compressed sRGBA, unsigned normalized. * @requires_gl * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} */ - CompressedBptcSRGBA = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, + CompressedBptcSRGBA = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB, /** * BPTC compressed RGB, signed float. * @requires_gl * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} */ - CompressedBptcRGBSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, + CompressedBptcRGBSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB, /** * BPTC compressed RGB, unsigned float. * @requires_gl * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} */ - CompressedBptcRGBUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, + CompressedBptcRGBUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB, + + /*}*/ /** * Depth component, at least 16bit. diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index 86b1c8594..a2da42736 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -85,7 +85,12 @@ class Renderbuffer { SRGBA = GL_SRGB8_ALPHA8, RGB10Alpha2 = GL_RGB10_A2, RGB10AlphaUnsigned2 = GL_RGB10_A2UI, RGB5Alpha1 = GL_RGB5_A1, RGBA4 = GL_RGBA4, RFloat11GFloat11BFloat10 = GL_R11F_G11F_B10F, + + /* 1.5.6 <= GLEW < 1.8.0 doesn't have this, even if there is + GL_ARB_ES2_compatibility */ + #if defined(GL_RGB565) || defined(DOXYGEN_GENERATING_OUTPUT) RGB565 = GL_RGB565, + #endif #ifndef MAGNUM_TARGET_GLES /**