From b7771de0a338f4b330b9126b19ede2d3416559d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Mar 2013 16:32:47 +0100 Subject: [PATCH 01/14] Set both TARGET_NACL and MAGNUM_TARGET_NACL in CMakeLists. Being consistent with all other options, all of them are both unprexfixed and prefixed in CMake (and then only prefixed versions are saved into `magnumConfigure.h` file). --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 799488f4a..81866daf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules/") if(${CMAKE_SYSTEM_NAME} STREQUAL NaCl) set(TARGET_GLES 1) set(TARGET_GLES2 1) + set(TARGET_NACL 1) set(MAGNUM_TARGET_NACL 1) endif() From fa7665d63e8ae6507018855450fcce24f8b02a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Mar 2013 16:34:20 +0100 Subject: [PATCH 02/14] Platform: no need to include GL headers just for GL_TRUE. It is, always was and always will be defined as 1, so why bother. --- src/Platform/NaClApplication.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index 2508b50bd..d9a30ad32 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -454,7 +454,7 @@ namespace Implementation { } inline bool Init() override { - return glInitializePPAPI(get_browser_interface()) == GL_TRUE; + return glInitializePPAPI(get_browser_interface()); } inline pp::Instance* CreateInstance(PP_Instance instance) { From d6d69c40adce55c6a05a92acd88774589fce2bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Mar 2013 16:35:21 +0100 Subject: [PATCH 03/14] Fix comma at the end of enumeration list. I know C99/C++11 allows this, but for me this is as bad as wrong whitespaces or superfluous `;` characters. --- src/AbstractImage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AbstractImage.h b/src/AbstractImage.h index 0274d5846..36f3fc51c 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -431,7 +431,7 @@ class MAGNUM_EXPORT AbstractImage { * @requires_gles30 %Extension @es_extension{OES,packed_depth_stencil} */ #ifdef MAGNUM_TARGET_GLES2 - UnsignedInt248 = GL_UNSIGNED_INT_24_8_OES, + UnsignedInt248 = GL_UNSIGNED_INT_24_8_OES #else UnsignedInt248 = GL_UNSIGNED_INT_24_8, From 78b52627c4b9e543c53060c12e0f364405fe3930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Mar 2013 16:37:21 +0100 Subject: [PATCH 04/14] Platform: fix warning about undeclared function. --- src/Platform/NaClApplication.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index d9a30ad32..da9c6a497 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -475,6 +475,7 @@ When no other application header is included this macro is also aliased to /* look at that insane placement of __attribute__. WTF. */ #define MAGNUM_NACLAPPLICATION_MAIN(application) \ namespace pp { \ + Module __attribute__ ((visibility ("default"))) * CreateModule(); \ Module __attribute__ ((visibility ("default"))) * CreateModule() { \ return new Magnum::Platform::Implementation::NaClModule(); \ } \ From adde9154cd3110d029f7745b4afebf22d74229db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Mar 2013 16:37:58 +0100 Subject: [PATCH 05/14] Doc++ --- src/Buffer.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Buffer.h b/src/Buffer.h index 9fe1d26bc..6f28cfb23 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -423,6 +423,8 @@ class MAGNUM_EXPORT Buffer { * @brief Memory mapping flags * * @see map(GLintptr, GLsizeiptr, MapFlags) + * @requires_gl30 %Extension @extension{ARB,map_buffer_range} + * @requires_gles30 %Extension @es_extension{EXT,map_buffer_range} */ typedef Corrade::Containers::EnumSet MapFlags; From f56ebd45076bb4a478449cbc83c6953ea456d59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Mar 2013 17:41:00 +0100 Subject: [PATCH 06/14] Fix OES_required_internalformat-related enums in AbstractTexture. Some values are present in ES2 itself, thus no need to use the ones defined by the extension for ES1. --- src/AbstractTexture.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 6f256102a..54a58b2ec 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -649,11 +649,7 @@ class MAGNUM_EXPORT AbstractTexture { * RGB, normalized unsigned, red and blue component 5bit, green 6bit. * @requires_gles30 %Extension @es_extension{OES,required_internalformat} */ - #ifndef MAGNUM_TARGET_GLES2 RGB565 = GL_RGB565, - #else - RGB565 = GL_RGB565_OES, - #endif #endif /** @@ -685,21 +681,13 @@ class MAGNUM_EXPORT AbstractTexture { * RGBA, normalized unsigned, each component 4bit. * @requires_gles30 %Extension @es_extension{OES,required_internalformat} */ - #ifndef MAGNUM_TARGET_GLES2 RGBA4 = GL_RGBA4, - #else - RGBA4 = GL_RGBA4_OES, - #endif /** * RGBA, normalized unsigned, each RGB component 5bit, alpha 1bit. * @requires_gles30 %Extension @es_extension{OES,required_internalformat} */ - #ifndef MAGNUM_TARGET_GLES2 RGB5A1 = GL_RGB5_A1, - #else - RGB5A1 = GL_RGB5_A1_OES, - #endif /** * RGBA, normalized unsigned, each RGB component 10bit, alpha 2bit. From 86f30b6b69e60e891f64bf23efe5bab9b6983dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 09:39:07 +0100 Subject: [PATCH 07/14] Clarified AbstractImage Format and Type enum documentation. Each value is now documented if it can be used for framebuffer reading or texture data only. --- src/AbstractImage.h | 117 ++++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 43 deletions(-) diff --git a/src/AbstractImage.h b/src/AbstractImage.h index 36f3fc51c..17f9cacb8 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -64,14 +64,15 @@ class MAGNUM_EXPORT AbstractImage { /** * @brief Format of pixel data * - * @todo What is allowed for FB reading and what for image - * specification? * @see pixelSize() */ enum class Format: GLenum { /** * Floating-point red channel. - * @requires_gles30 %Extension @es_extension{EXT,texture_rg} + * @requires_gles30 For texture data only, extension + * @es_extension{EXT,texture_rg}. + * @requires_es_extension For framebuffer reading, extension + * @es_extension{EXT,texture_rg}. */ #ifndef MAGNUM_TARGET_GLES2 Red = GL_RED, @@ -81,14 +82,14 @@ class MAGNUM_EXPORT AbstractImage { #ifndef MAGNUM_TARGET_GLES /** - * Floating-point green channel. For framebuffer reading only. + * Floating-point green channel. * @requires_gl Only @ref Magnum::AbstractImage::Format "Format::Red" * is available in OpenGL ES. */ Green = GL_GREEN, /** - * Floating-point blue channel. For framebuffer reading only. + * Floating-point blue channel. * @requires_gl Only @ref Magnum::AbstractImage::Format "Format::Red" * is available in OpenGL ES. */ @@ -98,10 +99,13 @@ class MAGNUM_EXPORT AbstractImage { #endif /** - * Floating-point red and green channel. For texture data only. + * Floating-point red and green channel. * @requires_gl30 %Extension @extension{ARB,texture_rg} and * @extension{EXT,texture_integer} - * @requires_gles30 %Extension @es_extension{EXT,texture_rg} + * @requires_gles30 For texture data only, extension + * @es_extension{EXT,texture_rg}. + * @requires_es_extension For framebuffer reading, extension + * @es_extension{EXT,texture_rg}. */ #ifndef MAGNUM_TARGET_GLES2 RG = GL_RG, @@ -109,7 +113,10 @@ class MAGNUM_EXPORT AbstractImage { RG = GL_RG_EXT, #endif - /** Floating-point RGB. */ + /** + * Floating-point RGB. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + */ RGB = GL_RGB, /** Floating-point RGBA. */ @@ -170,16 +177,18 @@ class MAGNUM_EXPORT AbstractImage { * Integer red and green channel. * @requires_gl30 %Extension @extension{ARB,texture_rg} and * @extension{EXT,texture_integer} - * @requires_gles30 Only floating-point image data are available - * in OpenGL ES 2.0. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + * @requires_gles30 For texture data only, only floating-point image + * data are available in OpenGL ES 2.0. */ RGInteger = GL_RG_INTEGER, /** * Integer RGB. * @requires_gl30 %Extension @extension{EXT,texture_integer} - * @requires_gles30 Only floating-point image data are available - * in OpenGL ES 2.0. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + * @requires_gles30 For texture data only, only floating-point image + * data are available in OpenGL ES 2.0. */ RGBInteger = GL_RGB_INTEGER, @@ -213,8 +222,9 @@ class MAGNUM_EXPORT AbstractImage { #endif /** - * Depth component. For framebuffer reading only. - * @requires_gles30 %Extension @es_extension2{NV,read_depth,GL_NV_read_depth_stencil} + * Depth component. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension2{NV,read_depth,GL_NV_read_depth_stencil}. */ DepthComponent = GL_DEPTH_COMPONENT, @@ -230,9 +240,12 @@ class MAGNUM_EXPORT AbstractImage { #endif /** - * Depth and stencil. For framebuffer reading only. + * Depth and stencil. * @requires_gl30 %Extension @extension{EXT,packed_depth_stencil} - * @requires_gles30 %Extension @es_extension2{NV,read_depth_stencil,GL_NV_read_depth_stencil} + * @requires_gles30 For texture data only, extension + * @es_extension{OES,packed_depth_stencil}. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension2{NV,read_depth_stencil,GL_NV_read_depth_stencil}. */ #ifndef MAGNUM_TARGET_GLES2 DepthStencil = GL_DEPTH_STENCIL @@ -253,30 +266,39 @@ class MAGNUM_EXPORT AbstractImage { #ifndef MAGNUM_TARGET_GLES2 /** * Each component signed byte. - * @requires_gles30 Only @ref Magnum::AbstractImage::Type "Type::UnsignedByte" - * is available in OpenGL ES 2.0. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + * @requires_gles30 For texture data only, only + * @ref Magnum::AbstractImage::Type "Type::UnsignedByte" is + * available in OpenGL ES 2.0. */ Byte = GL_BYTE, #endif /** * Each component unsigned short. - * @requires_gles30 %Extension @es_extension{OES,depth_texture} + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + * @requires_gles30 For texture data only, extension + * @es_extension{OES,depth_texture} or @es_extension{ANGLE,depth_texture}. */ UnsignedShort = GL_UNSIGNED_SHORT, #ifndef MAGNUM_TARGET_GLES2 /** * Each component signed short. - * @requires_gles30 Only @ref Magnum::AbstractImage::Type "Type::UnsignedShort" - * is available in OpenGL ES 2.0. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + * @requires_gles30 For texture data only, only + * @ref Magnum::AbstractImage::Type "Type::UnsignedShort" is + * available in OpenGL ES 2.0. */ Short = GL_SHORT, #endif /** * Each component unsigned int. - * @requires_gles30 %Extension @es_extension{OES,depth_texture} + * @requires_gles30 Can't be used for framebuffer reading in OpenGL + * ES 2.0. + * @requires_gles30 For texture data only, extension + * @es_extension{OES,depth_texture} or @es_extension{ANGLE,depth_texture}. */ UnsignedInt = GL_UNSIGNED_INT, @@ -290,10 +312,10 @@ class MAGNUM_EXPORT AbstractImage { #endif /** - * Each component half float. For framebuffer reading only. + * Each component half float. * @requires_gl30 %Extension @extension{NV,half_float} / @extension{ARB,half_float_pixel} - * @requires_gles30 %Extension @es_extension2{OES,texture_half_float,OES_texture_float}, - * for texture data only. + * @requires_gles30 For texture data only, extension + * @es_extension2{OES,texture_half_float,OES_texture_float}. */ #ifndef MAGNUM_TARGET_GLES2 HalfFloat = GL_HALF_FLOAT, @@ -303,7 +325,8 @@ class MAGNUM_EXPORT AbstractImage { /** * Each component float. - * @requires_gles30 %Extension @es_extension{OES,texture_float} + * @requires_gles30 For texture data only, extension + * @es_extension{OES,texture_float}. */ Float = GL_FLOAT, @@ -323,7 +346,10 @@ class MAGNUM_EXPORT AbstractImage { UnsignedByte233Rev = GL_UNSIGNED_BYTE_2_3_3_REV, #endif - /** RGB, unsigned byte, red and blue component 5bit, green 6bit. */ + /** + * RGB, unsigned byte, red and blue component 5bit, green 6bit. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + */ UnsignedShort565 = GL_UNSIGNED_SHORT_5_6_5, #ifndef MAGNUM_TARGET_GLES @@ -335,13 +361,16 @@ class MAGNUM_EXPORT AbstractImage { UnsignedShort565Rev = GL_UNSIGNED_SHORT_5_6_5_REV, #endif - /** RGBA, unsigned short, each component 4bit. */ + /** + * RGBA, unsigned short, each component 4bit. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. + */ UnsignedShort4444 = GL_UNSIGNED_SHORT_4_4_4_4, /** * ABGR, unsigned short, each component 4bit. - * @requires_es_extension %Extension @es_extension{EXT,read_format_bgra}, - * for framebuffer reading only. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension{EXT,read_format_bgra}. */ #ifndef MAGNUM_TARGET_GLES UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV, @@ -352,14 +381,15 @@ class MAGNUM_EXPORT AbstractImage { /** * RGBA, unsigned short, each RGB component 5bit, alpha component * 1bit. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES. */ UnsignedShort5551 = GL_UNSIGNED_SHORT_5_5_5_1, /** * ABGR, unsigned short, each RGB component 5bit, alpha component * 1bit. - * @requires_es_extension %Extension @es_extension{EXT,read_format_bgra}, - * for framebuffer reading only. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension{EXT,read_format_bgra}. */ #ifndef MAGNUM_TARGET_GLES UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV, @@ -395,8 +425,10 @@ class MAGNUM_EXPORT AbstractImage { /** * ABGR, unsigned int, each RGB component 10bit, alpha component * 2bit. - * @requires_gles30 %Extension @es_extension{EXT,texture_type_2_10_10_10_REV}, - * for texture data only. + * @requires_gles30 Can't be used for framebuffer reading in OpenGL + * ES 2.0. + * @requires_gles30 For texture data only, extension + * @es_extension{EXT,texture_type_2_10_10_10_REV}. */ #ifndef MAGNUM_TARGET_GLES2 UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV, @@ -407,7 +439,6 @@ class MAGNUM_EXPORT AbstractImage { #ifndef MAGNUM_TARGET_GLES2 /** * BGR, unsigned int, red and green 11bit float, blue 10bit float. - * For framebuffer reading only. * @requires_gl30 %Extension @extension{EXT,packed_float} * @requires_gles30 Floating-point types are not available in * OpenGL ES 2.0. @@ -415,8 +446,7 @@ class MAGNUM_EXPORT AbstractImage { UnsignedInt10F11F11FRev = GL_UNSIGNED_INT_10F_11F_11F_REV, /** - * BGR, unsigned int, each component 9bit + 5bit exponent. For - * framebuffer reading only. + * BGR, unsigned int, each component 9bit + 5bit exponent. * @requires_gl30 %Extension @extension{EXT,texture_shared_exponent} * @requires_gles30 Only 8bit and 16bit types are available in * OpenGL ES 2.0. @@ -425,10 +455,10 @@ class MAGNUM_EXPORT AbstractImage { #endif /** - * Unsigned int, depth component 24bit, stencil index 8bit. For - * framebuffer reading only. + * Unsigned int, depth component 24bit, stencil index 8bit. * @requires_gl30 %Extension @extension{EXT,packed_depth_stencil} - * @requires_gles30 %Extension @es_extension{OES,packed_depth_stencil} + * @requires_gles30 For texture data only, extension + * @es_extension{OES,packed_depth_stencil}. */ #ifdef MAGNUM_TARGET_GLES2 UnsignedInt248 = GL_UNSIGNED_INT_24_8_OES @@ -437,10 +467,11 @@ class MAGNUM_EXPORT AbstractImage { /** * Float + unsigned int, depth component 32bit float, 24bit gap, - * stencil index 8bit. For framebuffer reading only. + * stencil index 8bit. * @requires_gl30 %Extension @extension{ARB,depth_buffer_float} - * @requires_gles30 Only @ref Magnum::AbstractImage::Type "Type::UnsignedInt248" - * is available in OpenGL ES 2.0. + * @requires_gles30 For texture data only, only + * @ref Magnum::AbstractImage::Type "Type::UnsignedInt248" is + * available in OpenGL ES 2.0. */ Float32UnsignedInt248Rev = GL_FLOAT_32_UNSIGNED_INT_24_8_REV #endif From e96503810adf9b10891fd679b9697b455a5c82d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 09:54:36 +0100 Subject: [PATCH 08/14] Updated external OpenGl headers, added missing `GLES2/gl2platform.h`. --- external/GL/glcorearb.h | 9 +- external/GLES2/gl2.h | 6 +- external/GLES2/gl2ext.h | 181 ++++++++++++++++++++++++++++++++--- external/GLES2/gl2platform.h | 30 ++++++ external/GLES3/gl3.h | 8 +- 5 files changed, 213 insertions(+), 21 deletions(-) create mode 100644 external/GLES2/gl2platform.h diff --git a/external/GL/glcorearb.h b/external/GL/glcorearb.h index 34e61f297..855606477 100644 --- a/external/GL/glcorearb.h +++ b/external/GL/glcorearb.h @@ -31,9 +31,9 @@ extern "C" { /* glcorearb.h replaces gl3.h. It is for use with OpenGL core * profile implementations. * - * glcorearb.h last updated on $Date: 2012-09-19 19:02:24 -0700 (Wed, 19 Sep 2012) $ + * glcorearb.h last updated on $Date: 2013-02-07 01:42:49 -0800 (Thu, 07 Feb 2013) $ * - * RELEASE NOTES - 2012/09/19 + * RELEASE NOTES - 2013/02/07 * * glcorearb.h should be placed in the same directory as gl.h and * included as @@ -2707,6 +2707,11 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum typedef GLintptr GLvdpauSurfaceNV; #endif +#ifndef GL_OES_fixed_point +/* GLint must be 32 bits, a relatively safe assumption on modern CPUs */ +typedef GLint GLfixed; +#endif + #ifndef GL_VERSION_1_0 #define GL_VERSION_1_0 1 #ifdef GLCOREARB_PROTOTYPES diff --git a/external/GLES2/gl2.h b/external/GLES2/gl2.h index b7fe76ee1..c2d835726 100644 --- a/external/GLES2/gl2.h +++ b/external/GLES2/gl2.h @@ -1,7 +1,7 @@ #ifndef __gl2_h_ #define __gl2_h_ -/* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ +/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */ #include @@ -527,7 +527,7 @@ GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL GLenum GL_APIENTRY glGetError (void); @@ -546,7 +546,7 @@ GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum p GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); diff --git a/external/GLES2/gl2ext.h b/external/GLES2/gl2ext.h index 9fb46cac9..d0827839b 100644 --- a/external/GLES2/gl2ext.h +++ b/external/GLES2/gl2ext.h @@ -1,7 +1,7 @@ #ifndef __gl2ext_h_ #define __gl2ext_h_ -/* $Revision: 20040 $ on $Date:: 2013-01-03 01:43:00 -0800 #$ */ +/* $Revision: 20800 $ on $Date:: 2013-03-07 03:33:09 -0800 #$ */ #ifdef __cplusplus extern "C" { @@ -294,6 +294,18 @@ typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLen * ANGLE extension tokens *------------------------------------------------------------------------*/ +/* GL_ANGLE_depth_texture */ +#ifndef GL_ANGLE_depth_texture +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_UNSIGNED_INT 0x1405 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + /* GL_ANGLE_framebuffer_blit */ #ifndef GL_ANGLE_framebuffer_blit #define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 @@ -319,6 +331,11 @@ typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLen #define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 #endif +/* GL_ANGLE_program_binary */ +#ifndef GL_ANGLE_program_binary +#define GL_PROGRAM_BINARY_ANGLE 0x93A6 +#endif + /* GL_ANGLE_texture_compression_dxt3 */ #ifndef GL_ANGLE_texture_compression_dxt3 #define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 @@ -618,9 +635,9 @@ typedef struct __GLsync *GLsync; /* GL_EXT_unpack_subimage */ #ifndef GL_EXT_unpack_subimage -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 +#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 #endif /*------------------------------------------------------------------------* @@ -638,7 +655,7 @@ typedef struct __GLsync *GLsync; /* GL_FJ_shader_binary_GCCSO */ #ifndef GL_FJ_shader_binary_GCCSO -#define GCCSO_SHADER_BINARY_FJ 0x9260 +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 #endif /*------------------------------------------------------------------------* @@ -669,6 +686,12 @@ typedef struct __GLsync *GLsync; #define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 #endif +/* GL_IMG_texture_compression_pvrtc2 */ +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 +#endif + /* GL_IMG_multisampled_render_to_texture */ #ifndef GL_IMG_multisampled_render_to_texture #define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 @@ -691,7 +714,7 @@ typedef struct __GLsync *GLsync; #define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 #define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 #define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 -#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 +#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 #endif /* GL_NV_depth_nonlinear */ @@ -736,6 +759,9 @@ typedef struct __GLsync *GLsync; #define GL_COLOR_ATTACHMENT15_NV 0x8CEF #endif +/* GL_NV_draw_instanced */ +/* No new tokens introduced by this extension. */ + /* GL_NV_fbo_color_attachments */ #ifndef GL_NV_fbo_color_attachments #define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF @@ -749,6 +775,29 @@ typedef struct __GLsync *GLsync; #define GL_FENCE_CONDITION_NV 0x84F4 #endif +/* GL_NV_framebuffer_blit */ +#ifndef GL_NV_framebuffer_blit +#define GL_READ_FRAMEBUFFER_NV 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA +#endif + +/* GL_NV_framebuffer_multisample */ +#ifndef GL_NV_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 +#define GL_MAX_SAMPLES_NV 0x8D57 +#endif + +/* GL_NV_generate_mipmap_sRGB */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_instanced_arrays */ +#ifndef GL_NV_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE +#endif + /* GL_NV_read_buffer */ #ifndef GL_NV_read_buffer #define GL_READ_BUFFER_NV 0x0C02 @@ -766,6 +815,36 @@ typedef struct __GLsync *GLsync; /* GL_NV_read_stencil */ /* No new tokens introduced by this extension. */ +/* GL_NV_shadow_samplers_array */ +#ifndef GL_NV_shadow_samplers_array +#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 +#endif + +/* GL_NV_shadow_samplers_cube */ +#ifndef GL_NV_shadow_samplers_cube +#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 +#endif + +/* GL_NV_sRGB_formats */ +#ifndef GL_NV_sRGB_formats +#define GL_SLUMINANCE_NV 0x8C46 +#define GL_SLUMINANCE_ALPHA_NV 0x8C44 +#define GL_SRGB8_NV 0x8C41 +#define GL_SLUMINANCE8_NV 0x8C47 +#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F +#define GL_ETC1_SRGB8_NV 0x88EE +#endif + +/* GL_NV_texture_border_clamp */ +#ifndef GL_NV_texture_border_clamp +#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 +#define GL_CLAMP_TO_BORDER_NV 0x812D +#endif + /* GL_NV_texture_compression_s3tc_update */ /* No new tokens introduced by this extension. */ @@ -1148,6 +1227,11 @@ typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monito * ANGLE extension functions *------------------------------------------------------------------------*/ +/* GL_ANGLE_depth_texture */ +#ifndef GL_ANGLE_depth_texture +#define GL_ANGLE_depth_texture 1 +#endif + /* GL_ANGLE_framebuffer_blit */ #ifndef GL_ANGLE_framebuffer_blit #define GL_ANGLE_framebuffer_blit 1 @@ -1173,9 +1257,9 @@ GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); #endif -typedef void (GL_APIENTRYP PFLGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFLGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); #endif /* GL_ANGLE_pack_reverse_row_order */ @@ -1183,6 +1267,11 @@ typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLu #define GL_ANGLE_pack_reverse_row_order 1 #endif +/* GL_ANGLE_program_binary */ +#ifndef GL_ANGLE_program_binary +#define GL_ANGLE_program_binary 1 +#endif + /* GL_ANGLE_texture_compression_dxt3 */ #ifndef GL_ANGLE_texture_compression_dxt3 #define GL_ANGLE_texture_compression_dxt3 1 @@ -1203,7 +1292,7 @@ typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLu #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); #endif -typedef void (GL_APIENTRYP PFLGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); #endif /*------------------------------------------------------------------------* @@ -1370,10 +1459,10 @@ typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint ind #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei); GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif @@ -1596,6 +1685,11 @@ typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum #define GL_IMG_texture_compression_pvrtc 1 #endif +/* GL_IMG_texture_compression_pvrtc2 */ +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_IMG_texture_compression_pvrtc2 1 +#endif + /* GL_IMG_multisampled_render_to_texture */ #ifndef GL_IMG_multisampled_render_to_texture #define GL_IMG_multisampled_render_to_texture 1 @@ -1636,6 +1730,17 @@ GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); #endif +/* GL_NV_draw_instanced */ +#ifndef GL_NV_draw_instanced +#define GL_NV_draw_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif +typedef void (GL_APIENTRYP PFNDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + /* GL_NV_fbo_color_attachments */ #ifndef GL_NV_fbo_color_attachments #define GL_NV_fbo_color_attachments 1 @@ -1662,6 +1767,38 @@ typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); #endif +/* GL_NV_framebuffer_blit */ +#ifndef GL_NV_framebuffer_blit +#define GL_NV_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferNV (int srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +typedef void (GL_APIENTRYP PFNBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +/* GL_NV_framebuffer_multisample */ +#ifndef GL_NV_framebuffer_multisample +#define GL_NV_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +typedef void (GL_APIENTRYP PFNRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +/* GL_NV_generate_mipmap_sRGB */ +#ifndef GL_NV_generate_mipmap_sRGB +#define GL_NV_generate_mipmap_sRGB 1 +#endif + +/* GL_NV_instanced_arrays */ +#ifndef GL_NV_instanced_arrays +#define GL_NV_instanced_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); +#endif +typedef void (GL_APIENTRYP PFNVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); +#endif + /* GL_NV_read_buffer */ #ifndef GL_NV_read_buffer #define GL_NV_read_buffer 1 @@ -1691,6 +1828,26 @@ typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); #define GL_NV_read_stencil 1 #endif +/* GL_NV_shadow_samplers_array */ +#ifndef GL_NV_shadow_samplers_array +#define GL_NV_shadow_samplers_array 1 +#endif + +/* GL_NV_shadow_samplers_cube */ +#ifndef GL_NV_shadow_samplers_cube +#define GL_NV_shadow_samplers_cube 1 +#endif + +/* GL_NV_sRGB_formats */ +#ifndef GL_NV_sRGB_formats +#define GL_NV_sRGB_formats 1 +#endif + +/* GL_NV_texture_border_clamp */ +#ifndef GL_NV_texture_border_clamp +#define GL_NV_texture_border_clamp 1 +#endif + /* GL_NV_texture_compression_s3tc_update */ #ifndef GL_NV_texture_compression_s3tc_update #define GL_NV_texture_compression_s3tc_update 1 diff --git a/external/GLES2/gl2platform.h b/external/GLES2/gl2platform.h new file mode 100644 index 000000000..c9fa3c4d6 --- /dev/null +++ b/external/GLES2/gl2platform.h @@ -0,0 +1,30 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "OpenGL-ES" component "Registry". + */ + +#include + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ diff --git a/external/GLES3/gl3.h b/external/GLES3/gl3.h index 4d49393e2..b7e91e688 100644 --- a/external/GLES3/gl3.h +++ b/external/GLES3/gl3.h @@ -2,7 +2,7 @@ #define __gl3_h_ /* - * gl3.h last updated on $Date: 2012-10-03 07:52:40 -0700 (Wed, 03 Oct 2012) $ + * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $ */ #include @@ -12,7 +12,7 @@ extern "C" { #endif /* -** Copyright (c) 2007-2012 The Khronos Group Inc. +** Copyright (c) 2007-2013 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -861,7 +861,7 @@ GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL GLenum GL_APIENTRY glGetError (void); @@ -880,7 +880,7 @@ GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); From 8f37ebe9cfcd24d852f4d42bd9add5ba5836201e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 10:31:13 +0100 Subject: [PATCH 09/14] Better usage of external OpenGL headers. Moved them to `OpenGL/` subdirectory, allowing them to be included explicitly with e.g. overriding the system header. Our versions of the headers are thus now explicitly included in `OpenGL.h`, but they can be also included using no-prefix path if no system version is available. It might break some ES platforms, they will be fixed when found. The headers are now installed into `Magnum/OpenGL` (not into any artificial `external` directory). Now also installing GLES2 headers for OpenGL ES 2 (previously ES3 headers were installed for both ES2 and ES3). --- CMakeLists.txt | 2 -- external/CMakeLists.txt | 7 +---- external/OpenGL/CMakeLists.txt | 34 ++++++++++++++++++++++ external/{ => OpenGL}/GL/CMakeLists.txt | 2 +- external/{ => OpenGL}/GL/glcorearb.h | 0 external/OpenGL/GLES2/CMakeLists.txt | 25 ++++++++++++++++ external/{ => OpenGL}/GLES2/gl2.h | 0 external/{ => OpenGL}/GLES2/gl2ext.h | 0 external/{ => OpenGL}/GLES2/gl2platform.h | 0 external/{ => OpenGL}/GLES3/CMakeLists.txt | 2 +- external/{ => OpenGL}/GLES3/gl3.h | 0 external/{ => OpenGL}/GLES3/gl3platform.h | 0 external/{ => OpenGL}/KHR/CMakeLists.txt | 2 +- external/{ => OpenGL}/KHR/khrplatform.h | 0 modules/FindMagnum.cmake | 2 +- src/CMakeLists.txt | 11 ++++++- src/OpenGL.h | 11 ++++--- 17 files changed, 81 insertions(+), 17 deletions(-) create mode 100644 external/OpenGL/CMakeLists.txt rename external/{ => OpenGL}/GL/CMakeLists.txt (98%) rename external/{ => OpenGL}/GL/glcorearb.h (100%) create mode 100644 external/OpenGL/GLES2/CMakeLists.txt rename external/{ => OpenGL}/GLES2/gl2.h (100%) rename external/{ => OpenGL}/GLES2/gl2ext.h (100%) rename external/{ => OpenGL}/GLES2/gl2platform.h (100%) rename external/{ => OpenGL}/GLES3/CMakeLists.txt (97%) rename external/{ => OpenGL}/GLES3/gl3.h (100%) rename external/{ => OpenGL}/GLES3/gl3platform.h (100%) rename external/{ => OpenGL}/KHR/CMakeLists.txt (98%) rename external/{ => OpenGL}/KHR/khrplatform.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81866daf4..d879b26f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,8 +104,6 @@ set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) set(MAGNUM_CMAKE_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules) set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum) -include_directories(${CMAKE_SOURCE_DIR}/external) - add_subdirectory(external) add_subdirectory(modules) add_subdirectory(src) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index e4e61ff4a..4779291a4 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -22,9 +22,4 @@ # DEALINGS IN THE SOFTWARE. # -if(NOT TARGET_GLES) - add_subdirectory(GL) -else() - add_subdirectory(GLES3) - add_subdirectory(KHR) -endif() +add_subdirectory(OpenGL) diff --git a/external/OpenGL/CMakeLists.txt b/external/OpenGL/CMakeLists.txt new file mode 100644 index 000000000..9a8a35ef7 --- /dev/null +++ b/external/OpenGL/CMakeLists.txt @@ -0,0 +1,34 @@ +# +# This file is part of Magnum. +# +# Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# + +if(NOT TARGET_GLES) + add_subdirectory(GL) +else() + add_subdirectory(KHR) + if(TARGET_GLES2) + add_subdirectory(GLES2) + else() + add_subdirectory(GLES3) + endif() +endif() diff --git a/external/GL/CMakeLists.txt b/external/OpenGL/GL/CMakeLists.txt similarity index 98% rename from external/GL/CMakeLists.txt rename to external/OpenGL/GL/CMakeLists.txt index 0cfe57d4e..ef834c7d4 100644 --- a/external/GL/CMakeLists.txt +++ b/external/OpenGL/GL/CMakeLists.txt @@ -22,4 +22,4 @@ # DEALINGS IN THE SOFTWARE. # -install(FILES glcorearb.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/external/GL) +install(FILES glcorearb.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GL) diff --git a/external/GL/glcorearb.h b/external/OpenGL/GL/glcorearb.h similarity index 100% rename from external/GL/glcorearb.h rename to external/OpenGL/GL/glcorearb.h diff --git a/external/OpenGL/GLES2/CMakeLists.txt b/external/OpenGL/GLES2/CMakeLists.txt new file mode 100644 index 000000000..3115869a1 --- /dev/null +++ b/external/OpenGL/GLES2/CMakeLists.txt @@ -0,0 +1,25 @@ +# +# This file is part of Magnum. +# +# Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# + +install(FILES gl2.h gl2platform.h gl2ext.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES2) diff --git a/external/GLES2/gl2.h b/external/OpenGL/GLES2/gl2.h similarity index 100% rename from external/GLES2/gl2.h rename to external/OpenGL/GLES2/gl2.h diff --git a/external/GLES2/gl2ext.h b/external/OpenGL/GLES2/gl2ext.h similarity index 100% rename from external/GLES2/gl2ext.h rename to external/OpenGL/GLES2/gl2ext.h diff --git a/external/GLES2/gl2platform.h b/external/OpenGL/GLES2/gl2platform.h similarity index 100% rename from external/GLES2/gl2platform.h rename to external/OpenGL/GLES2/gl2platform.h diff --git a/external/GLES3/CMakeLists.txt b/external/OpenGL/GLES3/CMakeLists.txt similarity index 97% rename from external/GLES3/CMakeLists.txt rename to external/OpenGL/GLES3/CMakeLists.txt index ccb237ced..6699d72ba 100644 --- a/external/GLES3/CMakeLists.txt +++ b/external/OpenGL/GLES3/CMakeLists.txt @@ -22,4 +22,4 @@ # DEALINGS IN THE SOFTWARE. # -install(FILES gl3.h gl3platform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/external/GLES3) +install(FILES gl3.h gl3platform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES3) diff --git a/external/GLES3/gl3.h b/external/OpenGL/GLES3/gl3.h similarity index 100% rename from external/GLES3/gl3.h rename to external/OpenGL/GLES3/gl3.h diff --git a/external/GLES3/gl3platform.h b/external/OpenGL/GLES3/gl3platform.h similarity index 100% rename from external/GLES3/gl3platform.h rename to external/OpenGL/GLES3/gl3platform.h diff --git a/external/KHR/CMakeLists.txt b/external/OpenGL/KHR/CMakeLists.txt similarity index 98% rename from external/KHR/CMakeLists.txt rename to external/OpenGL/KHR/CMakeLists.txt index ba1402551..9e8e1bd57 100644 --- a/external/KHR/CMakeLists.txt +++ b/external/OpenGL/KHR/CMakeLists.txt @@ -22,4 +22,4 @@ # DEALINGS IN THE SOFTWARE. # -install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/external/KHR) +install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/KHR) diff --git a/external/KHR/khrplatform.h b/external/OpenGL/KHR/khrplatform.h similarity index 100% rename from external/KHR/khrplatform.h rename to external/OpenGL/KHR/khrplatform.h diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index b94183bcb..35c635118 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -295,7 +295,7 @@ find_package_handle_standard_args(Magnum # Dependent libraries and includes set(MAGNUM_INCLUDE_DIRS ${MAGNUM_INCLUDE_DIR} - ${MAGNUM_INCLUDE_DIR}/external + ${MAGNUM_INCLUDE_DIR}/OpenGL ${CORRADE_INCLUDE_DIR}) set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARY} ${CORRADE_UTILITY_LIBRARY} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c5c733f48..0d1df7c4d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,7 +30,16 @@ if(CORRADE_GCC46_COMPATIBILITY) endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}") -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CORRADE_INCLUDE_DIR}) +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CORRADE_INCLUDE_DIR} + + # We can use both implicit include path (GLES2/gl2.h) where our headers can + # be overriden with system ones or explicit (OpenGL/GLES2/gl2ext.h) where + # only our headers will be used + ${CMAKE_SOURCE_DIR}/external + ${CMAKE_SOURCE_DIR}/external/OpenGL) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumConfigure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/magnumConfigure.h) diff --git a/src/OpenGL.h b/src/OpenGL.h index c166dea07..e02765a5c 100644 --- a/src/OpenGL.h +++ b/src/OpenGL.h @@ -32,13 +32,16 @@ #ifndef MAGNUM_TARGET_GLES #include -#include +#include #else +#include #ifndef MAGNUM_TARGET_GLES2 -#include +#include +#include #else -#include -#include +#include +#include +#include #endif #endif From 91531d5f5360c35974f7880cd68a3a18b66a6303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 10:57:09 +0100 Subject: [PATCH 10/14] Support for ES2 extension NV_framebuffer_blit. --- src/AbstractFramebuffer.h | 20 ++++++++++++-------- src/Context.cpp | 1 + src/Extensions.h | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index 0be1f2e34..5dd8b6d11 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -82,7 +82,8 @@ class MAGNUM_EXPORT AbstractFramebuffer { * * @see BlitMask * @requires_gl30 %Extension @extension{EXT,framebuffer_object} - * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} + * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or + * @es_extension{NV,framebuffer_blit} */ enum class Blit: GLbitfield { ColorBuffer = GL_COLOR_BUFFER_BIT, /**< Color buffer */ @@ -95,7 +96,8 @@ class MAGNUM_EXPORT AbstractFramebuffer { * * @see blit() * @requires_gl30 %Extension @extension{EXT,framebuffer_object} - * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} + * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or + * @es_extension{NV,framebuffer_blit} */ typedef Corrade::Containers::EnumSet BlitMask; @@ -120,8 +122,8 @@ class MAGNUM_EXPORT AbstractFramebuffer { /** * For reading only. * @requires_gl30 %Extension @extension{EXT,framebuffer_blit} - * @requires_gles30 %Extension @es_extension{APPLE,framebuffer_multisample} - * or @es_extension{ANGLE,framebuffer_blit} + * @requires_gles30 %Extension @es_extension{APPLE,framebuffer_multisample}, + * @es_extension{ANGLE,framebuffer_blit} or @es_extension{NV,framebuffer_blit} */ #ifndef MAGNUM_TARGET_GLES2 Read = GL_READ_FRAMEBUFFER, @@ -132,8 +134,8 @@ class MAGNUM_EXPORT AbstractFramebuffer { /** * For drawing only. * @requires_gl30 %Extension @extension{EXT,framebuffer_blit} - * @requires_gles30 %Extension @es_extension{APPLE,framebuffer_multisample} - * or @es_extension{ANGLE,framebuffer_blit} + * @requires_gles30 %Extension @es_extension{APPLE,framebuffer_multisample}, + * @es_extension{ANGLE,framebuffer_blit} or @es_extension{NV,framebuffer_blit} */ #ifndef MAGNUM_TARGET_GLES2 Draw = GL_DRAW_FRAMEBUFFER, @@ -161,7 +163,8 @@ class MAGNUM_EXPORT AbstractFramebuffer { * blitting operation. * @see @fn_gl{BlitFramebuffer} * @requires_gl30 %Extension @extension{EXT,framebuffer_blit} - * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} + * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or + * @es_extension{NV,framebuffer_blit} */ static void blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Rectanglei& sourceRectangle, const Rectanglei& destinationRectangle, BlitMask mask, BlitFilter filter); @@ -178,7 +181,8 @@ class MAGNUM_EXPORT AbstractFramebuffer { * @ref BlitFilter "BlitFilter::Nearest" filtering is used by default. * @see @fn_gl{BlitFramebuffer} * @requires_gl30 %Extension @extension{EXT,framebuffer_blit} - * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} + * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or + * @es_extension{NV,framebuffer_blit} */ inline static void blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Rectanglei& rectangle, BlitMask mask) { blit(source, destination, rectangle, rectangle, mask, BlitFilter::Nearest); diff --git a/src/Context.cpp b/src/Context.cpp index b30f2b251..9d511f0e1 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -232,6 +232,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,NV,read_buffer), _extension(GL,NV,read_depth), _extension(GL,NV,read_depth_stencil), + _extension(GL,NV,framebuffer_blit), // done _extension(GL,OES,depth24), _extension(GL,OES,element_index_uint), _extension(GL,OES,rgb8_rgba8), diff --git a/src/Extensions.h b/src/Extensions.h index aa570bef3..476f18101 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -209,6 +209,7 @@ namespace GL { _extension(GL,NV,read_depth, GLES200, GLES300) // #94 _extension(GL,NV,read_stencil, GLES200, None) // #94 _extension(GL,NV,read_depth_stencil, GLES200, GLES300) // #94 + _extension(GL,NV,framebuffer_blit, GLES200, GLES300) // #142 } namespace OES { _extension(GL,OES,depth24, GLES200, GLES300) // #24 _extension(GL,OES,depth32, GLES200, None) // #25 From 549b1466fc867193c0ddf6569bb3f5f81dd7ab98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 11:00:14 +0100 Subject: [PATCH 11/14] Support for ES2 extension ANGLE_depth_texture. --- src/AbstractImage.h | 2 ++ src/AbstractTexture.h | 18 +++++++++++------- src/Context.cpp | 1 + src/Extensions.h | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/AbstractImage.h b/src/AbstractImage.h index 17f9cacb8..ff6964bc9 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -223,6 +223,8 @@ class MAGNUM_EXPORT AbstractImage { /** * Depth component. + * @requires_gles30 For texture data only, extension + * @es_extension{ANGLE,depth_texture}. * @requires_es_extension For framebuffer reading only, extension * @es_extension2{NV,read_depth,GL_NV_read_depth_stencil}. */ diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 54a58b2ec..c20a4fc99 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -893,7 +893,8 @@ class MAGNUM_EXPORT AbstractTexture { * Depth component, size implementation-dependent. * @deprecated Prefer to use exactly specified version of this * format, e.g. @ref Magnum::AbstractTexture::InternalFormat "InternalFormat::DepthComponent16". - * @requires_gles30 %Extension @es_extension{OES,depth_texture} + * @requires_gles30 %Extension @es_extension{OES,depth_texture} or + * @es_extension{ANGLE,depth_texture} */ DepthComponent = GL_DEPTH_COMPONENT, @@ -911,8 +912,9 @@ class MAGNUM_EXPORT AbstractTexture { /** * Depth component, 16bit. - * @requires_gles30 %Extension @es_extension{OES,required_internalformat} - * and @es_extension{OES,depth_texture} + * @requires_gles30 %Extension (@es_extension{OES,required_internalformat} + * and @es_extension{OES,depth_texture}) or (@es_extension{EXT,texture_storage} + * and @es_extension{ANGLE,depth_texture}) */ DepthComponent16 = GL_DEPTH_COMPONENT16, @@ -929,8 +931,9 @@ class MAGNUM_EXPORT AbstractTexture { /** * Depth component, 32bit. - * @requires_es_extension %Extension @es_extension{OES,required_internalformat}, - * @es_extension{OES,depth_texture} and @es_extension{OES,depth32} + * @requires_es_extension %Extension (@es_extension{OES,required_internalformat}, + * @es_extension{OES,depth_texture} and @es_extension{OES,depth32}) + * or (@es_extension{EXT,texture_storage} and @es_extension{ANGLE,depth_texture}) */ #ifndef MAGNUM_TARGET_GLES2 DepthComponent32 = GL_DEPTH_COMPONENT32, @@ -951,8 +954,9 @@ class MAGNUM_EXPORT AbstractTexture { /** * 24bit depth and 8bit stencil component. * @requires_gl30 %Extension @extension{EXT,packed_depth_stencil} - * @requires_gles30 %Extension @es_extension{OES,required_internalformat} - * and @es_extension{OES,packed_depth_stencil} + * @requires_gles30 %Extension @es_extension{OES,packed_depth_stencil} + * and (@es_extension{OES,required_internalformat} or + * (@es_extension{EXT,texture_storage} and @es_extension{ANGLE,depth_texture})) */ #ifdef MAGNUM_TARGET_GLES2 Depth24Stencil8 = GL_DEPTH24_STENCIL8_OES diff --git a/src/Context.cpp b/src/Context.cpp index 9d511f0e1..62201b919 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -219,6 +219,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,OES,texture_3D)}; static const std::vector extensionsES300{ _extension(GL,ANGLE,framebuffer_blit), + _extension(GL,ANGLE,depth_texture), // done _extension(GL,APPLE,framebuffer_multisample), _extension(GL,ARM,rgba8), _extension(GL,EXT,texture_type_2_10_10_10_REV), diff --git a/src/Extensions.h b/src/Extensions.h index 476f18101..1f3480957 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -183,6 +183,7 @@ namespace GL { #line 1 namespace ANGLE { _extension(GL,ANGLE,framebuffer_blit, GLES200, GLES300) // #83 + _extension(GL,ANGLE,depth_texture, GLES200, GLES300) // #138 } namespace APPLE { _extension(GL,APPLE,framebuffer_multisample, GLES200, GLES300) // #78 _extension(GL,APPLE,texture_format_BGRA8888, GLES200, None) // #79 From b9cee8e0140bac185019ca45f9c9308db175ecfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 11:03:45 +0100 Subject: [PATCH 12/14] Support for ES2 extension NV_texture_border_clamp. --- src/AbstractTexture.h | 17 ++++++++++------- src/Context.cpp | 1 + src/Extensions.h | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index c20a4fc99..da7c8d3eb 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -150,16 +150,17 @@ class MAGNUM_EXPORT AbstractTexture { * Clamp to edge. Coordinates out of the range will be clamped to * first / last column / row in given direction. */ - ClampToEdge = GL_CLAMP_TO_EDGE + ClampToEdge = GL_CLAMP_TO_EDGE, - #ifndef MAGNUM_TARGET_GLES - , /** * Clamp to border color. Coordinates out of range will be clamped * to border color (set with setBorderColor()). - * @requires_gl Texture border is not available in OpenGL ES. + * @requires_es_extension %Extension @es_extension{NV,texture_border_clamp} */ + #ifndef MAGNUM_TARGET_GLES ClampToBorder = GL_CLAMP_TO_BORDER + #else + ClampToBorder = GL_CLAMP_TO_BORDER_NV #endif }; @@ -1074,7 +1075,6 @@ class MAGNUM_EXPORT AbstractTexture { return this; } - #ifndef MAGNUM_TARGET_GLES /** * @brief Set border color * @return Pointer to self (for method chaining) @@ -1086,13 +1086,16 @@ class MAGNUM_EXPORT AbstractTexture { * @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexParameter} * or @fn_gl_extension{TextureParameter,EXT,direct_state_access} * with @def_gl{TEXTURE_BORDER_COLOR} - * @requires_gl Texture border is not available in OpenGL ES. + * @requires_es_extension %Extension @es_extension{NV,texture_border_clamp} */ inline AbstractTexture* setBorderColor(const Color4<>& color) { + #ifndef MAGNUM_TARGET_GLES (this->*parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR, color.data()); + #else + (this->*parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR_NV, color.data()); + #endif return this; } - #endif /** * @brief Set max anisotropy diff --git a/src/Context.cpp b/src/Context.cpp index 62201b919..4d0ed0e7c 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -212,6 +212,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,EXT,sRGB), _extension(GL,NV,read_buffer_front), _extension(GL,NV,read_stencil), + _extension(GL,NV,texture_border_clamp), // done _extension(GL,OES,depth32), _extension(GL,OES,mapbuffer), _extension(GL,OES,stencil1), diff --git a/src/Extensions.h b/src/Extensions.h index 1f3480957..d1fdf312b 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -211,6 +211,7 @@ namespace GL { _extension(GL,NV,read_stencil, GLES200, None) // #94 _extension(GL,NV,read_depth_stencil, GLES200, GLES300) // #94 _extension(GL,NV,framebuffer_blit, GLES200, GLES300) // #142 + _extension(GL,NV,texture_border_clamp, GLES200, None) // #149 } namespace OES { _extension(GL,OES,depth24, GLES200, GLES300) // #24 _extension(GL,OES,depth32, GLES200, None) // #25 From 0c612dee3d7a47b09d1aef6b7fa89f16e4320ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 12:06:25 +0100 Subject: [PATCH 13/14] FindMagnum: provide MAGNUM_APPLICATION_{LIBRARIES,INCLUDE_DIRS} aliases. Convenience aliases to variables related to one particular *Application component, defined if and only if exactly one *Application component is requested and found. Meant to be used to simplify porting when each platform uses different *Application library. --- modules/FindMagnum.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 35c635118..ceae0e368 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -41,6 +41,10 @@ # MAGNUM_*_FOUND - Whether the component was found # MAGNUM_*_LIBRARIES - Component library and dependent libraries # MAGNUM_*_INCLUDE_DIRS - Include dirs of module dependencies +# If exactly one *Application component is requested and found, its +# libraries and include dirs are also available in convenience aliases +# MAGNUM_APPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS to +# simplify porting. # # Features of found Magnum library are exposed in these variables: # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES @@ -283,6 +287,19 @@ foreach(component ${Magnum_FIND_COMPONENTS}) # Don't expose variables w/o dependencies to end users mark_as_advanced(FORCE MAGNUM_${_COMPONENT}_LIBRARY _MAGNUM_${_COMPONENT}_INCLUDE_DIR) + + # If this is application library, make it available also in global + # MAGNUM_APPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS. If + # these variables are already set, unset them to avoid ambiguity. + if(${component} MATCHES .+Application) + if(NOT DEFINED MAGNUM_APPLICATION_LIBRARIES AND NOT DEFINED MAGNUM_APPLICATION_INCLUDE_DIRS) + set(MAGNUM_APPLICATION_LIBRARIES ${MAGNUM_${_COMPONENT}_LIBRARIES}) + set(MAGNUM_APPLICATION_INCLUDE_DIRS ${MAGNUM_${_COMPONENT}_INCLUDE_DIRS}) + else() + unset(MAGNUM_APPLICATION_LIBRARIES) + unset(MAGNUM_APPLICATION_INCLUDE_DIRS) + endif() + endif() else() set(Magnum_${component}_FOUND FALSE) endif() From cdbc12821f3114bba0403402e9789cc3d866d881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 20 Mar 2013 12:22:09 +0100 Subject: [PATCH 14/14] Fixed NaCl issues with gl2.h. Headers gl2.h and gl2ext.h shipped with NaCl are different to the official ones, which is causing linker issues, thus using NaCl's own gl2.h. They are otherwise similar, thus it should cause no compatibility issues. On the other hand, gl2ext.h shipped with NaCl is slightly outdated with some recent extensions missing. We are including the NaCl's one and then the official one over it (undefining the include guard). The symbols are guarded also by extensions, so it should cause no conflicts. --- external/OpenGL/GLES2/CMakeLists.txt | 12 +++++++++++- external/OpenGL/KHR/CMakeLists.txt | 5 ++++- src/OpenGL.h | 12 ++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/external/OpenGL/GLES2/CMakeLists.txt b/external/OpenGL/GLES2/CMakeLists.txt index 3115869a1..ffd77ee75 100644 --- a/external/OpenGL/GLES2/CMakeLists.txt +++ b/external/OpenGL/GLES2/CMakeLists.txt @@ -22,4 +22,14 @@ # DEALINGS IN THE SOFTWARE. # -install(FILES gl2.h gl2platform.h gl2ext.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES2) +set(MagnumOpenGL_HEADERS + gl2ext.h) + +# NaCl has its own gl2.h, this one causes linker issues +if(NOT TARGET_NACL) + set(MagnumOpenGL_HEADERS ${MagnumOpenGL_HEADERS} + gl2platform.h + gl2.h) +endif() + +install(FILES ${MagnumOpenGL_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES2) diff --git a/external/OpenGL/KHR/CMakeLists.txt b/external/OpenGL/KHR/CMakeLists.txt index 9e8e1bd57..1ca8ca9ec 100644 --- a/external/OpenGL/KHR/CMakeLists.txt +++ b/external/OpenGL/KHR/CMakeLists.txt @@ -22,4 +22,7 @@ # DEALINGS IN THE SOFTWARE. # -install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/KHR) +# NaCl has its own gl2.h, this one causes linker issues +if(NOT TARGET_NACL) + install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/KHR) +endif() diff --git a/src/OpenGL.h b/src/OpenGL.h index e02765a5c..463ad9d6f 100644 --- a/src/OpenGL.h +++ b/src/OpenGL.h @@ -34,6 +34,8 @@ #include #include #else + +#ifndef MAGNUM_TARGET_NACL #include #ifndef MAGNUM_TARGET_GLES2 #include @@ -43,6 +45,16 @@ #include #include #endif + +/* NaCl has its own gl2.h, the official one causes linker issues. Additionaly + to NaCl's gl2ext.h we are including our own to prevent undeclared symbol + errors with some recent extensions. */ +#else +#include +#include +#undef __gl2ext_h_ +#include #endif #endif +#endif