summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/context.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-02-27 18:43:48 +0100
committerKonstantin Käfer <mail@kkaefer.com>2019-03-01 09:33:37 +0100
commitfde7c20f36ce2ecfdd79d2722fc2f0bee72e7e99 (patch)
treee47f97900d812d438fb67f811c6e9fb00d2bd52b /src/mbgl/gl/context.cpp
parentda6e1390c68e01e02652104586c759d46e04c7fd (diff)
downloadqtlocation-mapboxgl-fde7c20f36ce2ecfdd79d2722fc2f0bee72e7e99.tar.gz
[core] move GL enum conversions to separate file
Diffstat (limited to 'src/mbgl/gl/context.cpp')
-rw-r--r--src/mbgl/gl/context.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index ee82fa76ae..a7b40b6448 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -1,4 +1,5 @@
#include <mbgl/gl/context.hpp>
+#include <mbgl/gl/enum.hpp>
#include <mbgl/gl/debugging_extension.hpp>
#include <mbgl/gl/vertex_array_extension.hpp>
#include <mbgl/gl/program_binary_extension.hpp>
@@ -735,7 +736,7 @@ void Context::setColorMode(const gfx::ColorMode& color) {
blend = true;
blendColor = color.blendColor;
apply_visitor([&] (const auto& blendFunction) {
- blendEquation = gfx::ColorMode::BlendEquation(blendFunction.equation);
+ blendEquation = gfx::ColorBlendEquationType(blendFunction.equation);
blendFunc = { blendFunction.srcFactor, blendFunction.dstFactor };
}, color.blendFunction);
}
@@ -743,24 +744,11 @@ void Context::setColorMode(const gfx::ColorMode& color) {
colorMask = color.mask;
}
-GLenum toGLenum(const gfx::PrimitiveType primitiveType) {
- switch (primitiveType) {
- case gfx::PrimitiveType::Points: return GL_POINTS;
- case gfx::PrimitiveType::Lines: return GL_LINES;
- case gfx::PrimitiveType::LineLoop: return GL_LINE_LOOP;
- case gfx::PrimitiveType::LineStrip: return GL_LINE_STRIP;
- case gfx::PrimitiveType::Triangles: return GL_TRIANGLES;
- case gfx::PrimitiveType::TriangleStrip: return GL_TRIANGLE_STRIP;
- case gfx::PrimitiveType::TriangleFan: return GL_TRIANGLE_FAN;
- }
- return GL_INVALID_ENUM;
-}
-
void Context::draw(gfx::PrimitiveType primitiveType,
std::size_t indexOffset,
std::size_t indexLength) {
MBGL_CHECK_ERROR(glDrawElements(
- toGLenum(primitiveType),
+ Enum<gfx::PrimitiveType>::to(primitiveType),
static_cast<GLsizei>(indexLength),
GL_UNSIGNED_SHORT,
reinterpret_cast<GLvoid*>(sizeof(uint16_t) * indexOffset)));