diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-12-04 18:29:42 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-12-04 20:02:50 +0100 |
commit | abafb52f37beb5659efc2105ccd1568e1f754898 (patch) | |
tree | 6a60636d3497560ca61e5aae5f6d7061c4f18553 /include/mbgl/geometry/vao.hpp | |
parent | bff6aeb4da41dee1f5f1cfa0be81b6c257257253 (diff) | |
download | qtlocation-mapboxgl-abafb52f37beb5659efc2105ccd1568e1f754898.tar.gz |
make most headers private
Diffstat (limited to 'include/mbgl/geometry/vao.hpp')
-rw-r--r-- | include/mbgl/geometry/vao.hpp | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/include/mbgl/geometry/vao.hpp b/include/mbgl/geometry/vao.hpp deleted file mode 100644 index 2ecba731f7..0000000000 --- a/include/mbgl/geometry/vao.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef MBGL_GEOMETRY_VAO -#define MBGL_GEOMETRY_VAO - -#include <mbgl/shader/shader.hpp> -#include <mbgl/platform/gl.hpp> -#include <mbgl/util/noncopyable.hpp> - -#include <stdexcept> - -namespace mbgl { - -class VertexArrayObject : public util::noncopyable { -public: - inline VertexArrayObject() {}; - - inline VertexArrayObject(VertexArrayObject &&rhs) noexcept - : vao(rhs.vao), - bound_shader(rhs.bound_shader), - bound_shader_name(rhs.bound_shader_name), - bound_vertex_buffer(rhs.bound_vertex_buffer), - bound_elements_buffer(rhs.bound_elements_buffer), - bound_offset(rhs.bound_offset) {}; - - template <typename Shader, typename VertexBuffer> - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, char *offset) { - bindVertexArrayObject(); - if (bound_shader == 0) { - vertexBuffer.bind(); - shader.bind(offset); - if (vao) { - storeBinding(shader, vertexBuffer.getID(), 0, offset); - } - } else { - verifyBinding(shader, vertexBuffer.getID(), 0, offset); - } - } - - template <typename Shader, typename VertexBuffer, typename ElementsBuffer> - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, char *offset) { - bindVertexArrayObject(); - if (bound_shader == 0) { - vertexBuffer.bind(); - elementsBuffer.bind(); - shader.bind(offset); - if (vao) { - storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); - } - } else { - verifyBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); - } - } - - ~VertexArrayObject(); - -private: - void bindVertexArrayObject(); - void storeBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, char *offset); - void verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, char *offset); - - GLuint vao = 0; - - // For debug reasons, we're storing the bind information so that we can - // detect errors and report - GLuint bound_shader = 0; - const char *bound_shader_name = ""; - GLuint bound_vertex_buffer = 0; - GLuint bound_elements_buffer = 0; - char *bound_offset = 0; -}; - -} - -#endif |