summaryrefslogtreecommitdiff
path: root/src/mbgl/gl
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-03-22 14:56:43 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-03-28 13:53:19 +0200
commitf70f604e5b99062a24764716ccdeda64c36320be (patch)
treedbdb1399eb0e23abb66fdb0496cebc70154945ee /src/mbgl/gl
parenta84aa453a9124867cb285f012abd97077ab2a019 (diff)
downloadqtlocation-mapboxgl-f70f604e5b99062a24764716ccdeda64c36320be.tar.gz
[core] Privatize gl/gl.hpp
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r--src/mbgl/gl/gl.hpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/mbgl/gl/gl.hpp b/src/mbgl/gl/gl.hpp
new file mode 100644
index 0000000000..3a577b289b
--- /dev/null
+++ b/src/mbgl/gl/gl.hpp
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <stdexcept>
+#include <limits>
+
+#if __APPLE__
+ #include "TargetConditionals.h"
+ #if TARGET_OS_IPHONE
+ #include <OpenGLES/ES2/gl.h>
+ #include <OpenGLES/ES2/glext.h>
+ #elif TARGET_IPHONE_SIMULATOR
+ #include <OpenGLES/ES2/gl.h>
+ #include <OpenGLES/ES2/glext.h>
+ #elif TARGET_OS_MAC
+ #include <OpenGL/OpenGL.h>
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glext.h>
+ #else
+ #error Unsupported Apple platform
+ #endif
+#elif __ANDROID__ || MBGL_USE_GLES2
+ #define GL_GLEXT_PROTOTYPES
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+#elif __QT_ && QT_VERSION >= 0x050000
+ #define GL_GLEXT_PROTOTYPES
+ #include <QtGui/qopengl.h>
+#else
+ #define GL_GLEXT_PROTOTYPES
+ #include <GL/gl.h>
+ #include <GL/glext.h>
+#endif
+
+namespace mbgl {
+namespace gl {
+
+struct Error : std::runtime_error {
+ using std::runtime_error::runtime_error;
+};
+
+void checkError(const char *cmd, const char *file, int line);
+
+#ifndef NDEBUG
+#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { ~__MBGL_C_E() noexcept(false) { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }())
+#else
+#define MBGL_CHECK_ERROR(cmd) (cmd)
+#endif
+
+} // namespace gl
+} // namespace mbgl