From a46b51b11f945abf0fcf464466a5abc049627710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 18 Aug 2012 16:06:47 +0200 Subject: [PATCH] Updated for OpenGL ES 2 support. --- src/Framebuffer.h | 28 ++++++++++++++++++++++++---- src/Mesh.cpp | 7 +++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/Framebuffer.h b/src/Framebuffer.h index b7eca5f0d..4df94c9bf 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -58,13 +58,14 @@ class MAGNUM_EXPORT Framebuffer { */ Blending = GL_BLEND, + #ifndef MAGNUM_TARGET_GLES /** * Logical operation * @see setLogicOperation() + * @requires_gl Logic operations on framebuffer are in desktop OpenGL only. */ LogicOperation = GL_COLOR_LOGIC_OP, - #ifndef MAGNUM_TARGET_GLES /** * Depth clamping. If enabled, ignores near and far clipping plane. * @requires_gl @@ -393,9 +394,24 @@ class MAGNUM_EXPORT Framebuffer { enum class BlendEquation: GLenum { Add = GL_FUNC_ADD, /**< `source + destination` */ Subtract = GL_FUNC_SUBTRACT, /**< `source - destination` */ - ReverseSubtract = GL_FUNC_REVERSE_SUBTRACT, /**< `destination - source` */ - Min = GL_MIN, /**< `min(source, destination)` */ - Max = GL_MAX /**< `max(source, destination)` */ + ReverseSubtract = GL_FUNC_REVERSE_SUBTRACT /**< `destination - source` */ + + #ifndef MAGNUM_TARGET_GLES + /** @todo Enable for ES3 when the headers are available */ + , + + /** + * `min(source, destination)` + * @requires_gles30 Extension @es_extension{EXT,blend_minmax} + */ + Min = GL_MIN, + + /** + * `max(source, destination)` + * @requires_gles30 Extension @es_extension{EXT,blend_minmax} + */ + Max = GL_MAX + #endif }; /** @@ -585,12 +601,14 @@ class MAGNUM_EXPORT Framebuffer { /*@}*/ + #ifndef MAGNUM_TARGET_GLES /** @{ @name Logical operation */ /** * @brief Logical operation * * @see setLogicOperation() + * @requires_gl */ enum class LogicOperation: GLenum { Clear = GL_CLEAR, /**< `0` */ @@ -615,12 +633,14 @@ class MAGNUM_EXPORT Framebuffer { * @brief Set logical operation * * @attention You have to enable logical operation with setFeature() first. + * @requires_gl Logic operations on framebuffer are in desktop OpenGL only. */ inline static void setLogicOperation(LogicOperation operation) { glLogicOp(static_cast(operation)); } /*@}*/ + #endif /** @{ @name Framebuffer creation and binding */ diff --git a/src/Mesh.cpp b/src/Mesh.cpp index edd0f44bc..93d789c0c 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -26,7 +26,9 @@ Mesh::Mesh(Mesh&& other): #endif _primitive(other._primitive), _vertexCount(other._vertexCount), finalized(other.finalized), _buffers(other._buffers), _attributes(other._attributes) { + #ifndef MAGNUM_TARGET_GLES other.vao = 0; + #endif } void Mesh::destroy() { @@ -41,13 +43,18 @@ void Mesh::destroy() { Mesh& Mesh::operator=(Mesh&& other) { destroy(); + #ifndef MAGNUM_TARGET_GLES vao = other.vao; + #endif _primitive = other._primitive; _vertexCount = other._vertexCount; finalized = other.finalized; _buffers = other._buffers; _attributes = other._attributes; + + #ifndef MAGNUM_TARGET_GLES other.vao = 0; + #endif return *this; }