diff --git a/include/mbgl/gl/gl_values.hpp b/include/mbgl/gl/gl_values.hpp index 34932dd40..1e05984fb 100644 --- a/include/mbgl/gl/gl_values.hpp +++ b/include/mbgl/gl/gl_values.hpp @@ -214,6 +214,19 @@ constexpr bool operator!=(const BlendFunc::Type& a, const BlendFunc::Type& b) { return a.sfactor != b.sfactor || a.dfactor != b.dfactor; } +struct BlendColor { + using Type = Color; + static const Type Default; + inline static void Set(const Type& value) { + MBGL_CHECK_ERROR(glBlendColor(value.r, value.g, value.b, value.a)); + } + inline static Type Get() { + GLfloat floats[4]; + MBGL_CHECK_ERROR(glGetFloatv(GL_BLEND_COLOR, floats)); + return { floats[0], floats[1], floats[2], floats[3] }; + } +}; + struct Program { using Type = GLuint; static const Type Default; diff --git a/src/mbgl/gl/gl_config.cpp b/src/mbgl/gl/gl_config.cpp index c3c6601e4..97d2f26f6 100644 --- a/src/mbgl/gl/gl_config.cpp +++ b/src/mbgl/gl/gl_config.cpp @@ -13,6 +13,7 @@ const DepthTest::Type DepthTest::Default = GL_FALSE; const DepthFunc::Type DepthFunc::Default = GL_LEQUAL; const Blend::Type Blend::Default = GL_TRUE; const BlendFunc::Type BlendFunc::Default = { GL_ONE, GL_ONE_MINUS_SRC_ALPHA }; +const BlendColor::Type BlendColor::Default = { 0, 0, 0, 0 }; const ColorMask::Type ColorMask::Default = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE }; const ClearDepth::Type ClearDepth::Default = 1; const ClearColor::Type ClearColor::Default = { 0, 0, 0, 0 }; diff --git a/src/mbgl/gl/gl_config.hpp b/src/mbgl/gl/gl_config.hpp index 66f440653..09080ca36 100644 --- a/src/mbgl/gl/gl_config.hpp +++ b/src/mbgl/gl/gl_config.hpp @@ -56,6 +56,7 @@ public: depthFunc.reset(); blend.reset(); blendFunc.reset(); + blendColor.reset(); colorMask.reset(); clearDepth.reset(); clearColor.reset(); @@ -80,6 +81,7 @@ public: depthFunc.setDirty(); blend.setDirty(); blendFunc.setDirty(); + blendColor.setDirty(); colorMask.setDirty(); clearDepth.setDirty(); clearColor.setDirty(); @@ -103,6 +105,7 @@ public: Value depthFunc; Value blend; Value blendFunc; + Value blendColor; Value colorMask; Value clearDepth; Value clearColor;