diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-11-07 12:26:05 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-11-08 08:09:29 -0800 |
commit | 1db2ffbc1b69069eca39f786cacc45dbb02c3052 (patch) | |
tree | 9d6ed2a7302492f41c52ea3fdeadabf6466b0d8d /src/mbgl/gl/attribute.hpp | |
parent | 66bdbc3b969083b9d647abdf72784be64a125949 (diff) | |
download | qtlocation-mapboxgl-1db2ffbc1b69069eca39f786cacc45dbb02c3052.tar.gz |
[core] Use gl::Program to resolve some rough edges in the GL binding types
* Extract `ignore` util to separate header.
* `Segment` now tracks offset and length of indices, rather than primitives. This is more natural.
* Introduce `VertexVector` and `IndexVector` types. These types carry information about the intended draw mode (`Triangles`, `LineStrip`, etc.), and ensure that elements are always appended in a group size appropriate for that draw mode, for both indexed and unindexed rendering.
* `Program`, rather than `Drawable`, is now the unifying object for draw calls. `Program` is the best place to type check the draw call, because it is typed to carry information about the intended primitive, vertex type, attributes, and uniforms.
* Use the debug shaders for debug tile rendering, like gl-js.
* Fix the draw mode for background. It was drawing triangle strips with a triangles array. Surprised this didn’t cause issues. Now it’s type checked.
Diffstat (limited to 'src/mbgl/gl/attribute.hpp')
-rw-r--r-- | src/mbgl/gl/attribute.hpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index 126da38de5..a2b165fa21 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -1,6 +1,7 @@ #pragma once #include <mbgl/gl/types.hpp> +#include <mbgl/util/ignore.hpp> #include <cstddef> #include <functional> @@ -157,17 +158,14 @@ private: template <std::size_t... Is> static std::function<void (std::size_t)> binder(const State& state, std::index_sequence<Is...>) { return [&state] (std::size_t vertexOffset) { - noop((bindAttribute(std::get<Is>(state).location, - std::get<Is>(state).count, - std::get<Is>(state).type, - sizeof(Vertex), - vertexOffset, - Vertex::attributeOffsets[Is]), 0)...); + ignore((bindAttribute(std::get<Is>(state).location, + std::get<Is>(state).count, + std::get<Is>(state).type, + sizeof(Vertex), + vertexOffset, + Vertex::attributeOffsets[Is]), 0)...); }; } - - // This exists only to provide a varags context for unpacking the assignments in `binder`. - template <int...> static void noop(int...) {} }; } // namespace gl |