summaryrefslogtreecommitdiff
path: root/include/llmr
diff options
context:
space:
mode:
authorKonstantin Käfer <github@kkaefer.com>2014-01-07 16:52:23 +0100
committerKonstantin Käfer <github@kkaefer.com>2014-01-07 16:52:23 +0100
commit528eaf475e084508cb2d2d26df7d4136f1eb5e04 (patch)
tree87f9a7ecec23cb7cc37450e7cd5f34fa6248f750 /include/llmr
parent044a7b5dcd92b1ba095f0768d24aa504fdf71a16 (diff)
downloadqtlocation-mapboxgl-528eaf475e084508cb2d2d26df7d4136f1eb5e04.tar.gz
emscripten support
Diffstat (limited to 'include/llmr')
-rw-r--r--include/llmr/geometry/linevertexbuffer.hpp4
-rw-r--r--include/llmr/platform/gl.hpp4
-rw-r--r--include/llmr/platform/platform.hpp2
-rw-r--r--include/llmr/renderer/painter.hpp14
-rw-r--r--include/llmr/renderer/shader-fill.hpp8
-rw-r--r--include/llmr/renderer/shader-line.hpp8
-rw-r--r--include/llmr/renderer/shader.hpp9
-rw-r--r--include/llmr/shader/shaders.h28
8 files changed, 50 insertions, 27 deletions
diff --git a/include/llmr/geometry/linevertexbuffer.hpp b/include/llmr/geometry/linevertexbuffer.hpp
index 8d5c6b335c..4d23de9154 100644
--- a/include/llmr/geometry/linevertexbuffer.hpp
+++ b/include/llmr/geometry/linevertexbuffer.hpp
@@ -1,8 +1,6 @@
#ifndef LLMR_GEOMETRY_LINEVERTEXBUFFER
#define LLMR_GEOMETRY_LINEVERTEXBUFFER
-#include "../platform/gl.hpp"
-
#include <vector>
namespace llmr {
@@ -18,7 +16,7 @@ public:
void bind();
private:
std::vector<uint16_t> array;
- GLuint buffer;
+ uint32_t buffer;
};
}
diff --git a/include/llmr/platform/gl.hpp b/include/llmr/platform/gl.hpp
index 4fa0cf4775..58d9099c70 100644
--- a/include/llmr/platform/gl.hpp
+++ b/include/llmr/platform/gl.hpp
@@ -1,7 +1,9 @@
#ifndef LLMR_RENDERER_GL
#define LLMR_RENDERER_GL
-#ifdef __APPLE__
+#ifdef EMSCRIPTEN
+ #include <GLES2/gl2.h>
+#elif __APPLE__
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
#include <OpenGLES/ES2/gl.h>
diff --git a/include/llmr/platform/platform.hpp b/include/llmr/platform/platform.hpp
index 46a1383c42..e8aa972d7b 100644
--- a/include/llmr/platform/platform.hpp
+++ b/include/llmr/platform/platform.hpp
@@ -8,8 +8,6 @@ class tile;
class platform {
public:
platform(void *obj) : obj(obj) {}
-
- const char *shaderSource(const char *name, const char *extension);
void restart();
void request(tile *tile);
diff --git a/include/llmr/renderer/painter.hpp b/include/llmr/renderer/painter.hpp
index ac6012b0d0..6c75171846 100644
--- a/include/llmr/renderer/painter.hpp
+++ b/include/llmr/renderer/painter.hpp
@@ -1,8 +1,6 @@
#ifndef LLMR_RENDERER_PAINTER
#define LLMR_RENDERER_PAINTER
-#include "../platform/gl.hpp"
-
#include "shader-fill.hpp"
#include "shader-line.hpp"
@@ -19,7 +17,7 @@ public:
void setup();
void teardown();
- void resize(GLuint new_width, GLuint new_height);
+ void resize(uint32_t new_width, uint32_t new_height);
void viewport();
@@ -38,16 +36,16 @@ public:
private:
platform *platform;
transform *transform;
- GLuint width, height;
- GLfloat matrix[16];
+ uint32_t width, height;
+ float matrix[16];
Shader *currentShader;
FillShader *fillShader;
LineShader *lineShader;
- GLuint vertexArray;
- GLuint triangleVertexBuffer;
- GLuint fillVertexBuffer;
+ uint32_t vertexArray;
+ uint32_t triangleVertexBuffer;
+ uint32_t fillVertexBuffer;
};
}
diff --git a/include/llmr/renderer/shader-fill.hpp b/include/llmr/renderer/shader-fill.hpp
index 165266e4b5..440f3011c6 100644
--- a/include/llmr/renderer/shader-fill.hpp
+++ b/include/llmr/renderer/shader-fill.hpp
@@ -7,11 +7,11 @@ namespace llmr {
class FillShader : public Shader {
public:
- FillShader(const GLchar *vertex, const GLchar *fragment);
+ FillShader();
- GLint a_pos;
- GLint u_matrix;
- GLint u_color;
+ int32_t a_pos;
+ int32_t u_matrix;
+ int32_t u_color;
};
}
diff --git a/include/llmr/renderer/shader-line.hpp b/include/llmr/renderer/shader-line.hpp
index 60e27146f9..b40ca0e0a7 100644
--- a/include/llmr/renderer/shader-line.hpp
+++ b/include/llmr/renderer/shader-line.hpp
@@ -7,11 +7,11 @@ namespace llmr {
class LineShader : public Shader {
public:
- LineShader(const GLchar *vertex, const GLchar *fragment);
+ LineShader();
- GLint a_pos;
- GLint u_matrix;
- GLint u_color;
+ int32_t a_pos;
+ int32_t u_matrix;
+ int32_t u_color;
};
}
diff --git a/include/llmr/renderer/shader.hpp b/include/llmr/renderer/shader.hpp
index d178a1d9c8..2968ad59fe 100644
--- a/include/llmr/renderer/shader.hpp
+++ b/include/llmr/renderer/shader.hpp
@@ -1,21 +1,20 @@
#ifndef LLMR_RENDERER_SHADER
#define LLMR_RENDERER_SHADER
-#include "../platform/gl.hpp"
#include <vector>
namespace llmr {
class Shader {
public:
- Shader(const GLchar *vertex, const GLchar *fragment);
+ Shader(const char *vertex, const char *fragment);
~Shader();
bool valid;
- GLuint program;
- std::vector<GLuint> attributes;
+ uint32_t program;
+ std::vector<uint32_t> attributes;
private:
- bool compileShader(GLuint *shader, GLenum type, const GLchar *source);
+ bool compileShader(uint32_t *shader, uint32_t type, const char *source);
};
}
diff --git a/include/llmr/shader/shaders.h b/include/llmr/shader/shaders.h
new file mode 100644
index 0000000000..038f07a2e9
--- /dev/null
+++ b/include/llmr/shader/shaders.h
@@ -0,0 +1,28 @@
+// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
+
+#ifndef LLMR_SHADER_SHADERS
+#define LLMR_SHADER_SHADERS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct llmr_shader {
+ const char *vertex;
+ const char *fragment;
+};
+typedef struct llmr_shader llmr_shader_t;
+
+enum {
+ FILL_SHADER,
+ LINE_SHADER,
+ SHADER_COUNT
+};
+
+extern const llmr_shader_t llmr_shaders[SHADER_COUNT];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif