diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-11-21 13:03:31 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-12-01 08:57:11 -0800 |
commit | 54c557d982c92caefd53a68e2f72bba822101c2c (patch) | |
tree | 09f97a8afea5c4bd92238ab196722006214c8a3b /src/mbgl/gl | |
parent | b1068b432ee17c14ea756b7c48be4c955303de95 (diff) | |
download | qtlocation-mapboxgl-54c557d982c92caefd53a68e2f72bba822101c2c.tar.gz |
[core] Use indexed rendering everywhere
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r-- | src/mbgl/gl/context.cpp | 17 | ||||
-rw-r--r-- | src/mbgl/gl/program.hpp | 26 | ||||
-rw-r--r-- | src/mbgl/gl/segment.hpp | 7 |
3 files changed, 5 insertions, 45 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 4c469d7f67..e4cc5e0fe3 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -518,18 +518,11 @@ void Context::draw(const Drawable& drawable) { drawable.bindAttributes(segment.vertexOffset); } - if (drawable.indexBuffer) { - MBGL_CHECK_ERROR(glDrawElements( - static_cast<GLenum>(primitiveType), - static_cast<GLsizei>(segment.indexLength), - GL_UNSIGNED_SHORT, - reinterpret_cast<GLvoid*>(sizeof(uint16_t) * segment.indexOffset))); - } else { - MBGL_CHECK_ERROR(glDrawArrays( - static_cast<GLenum>(primitiveType), - static_cast<GLint>(segment.vertexOffset), - static_cast<GLsizei>(segment.vertexLength))); - } + MBGL_CHECK_ERROR(glDrawElements( + static_cast<GLenum>(primitiveType), + static_cast<GLsizei>(segment.indexLength), + GL_UNSIGNED_SHORT, + reinterpret_cast<GLvoid*>(sizeof(uint16_t) * segment.indexOffset))); } } diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp index 01fa51e788..33387e9d4e 100644 --- a/src/mbgl/gl/program.hpp +++ b/src/mbgl/gl/program.hpp @@ -32,7 +32,6 @@ public: attributesState(Attributes::state(program)), uniformsState((context.linkProgram(program), Uniforms::state(program))) {} - // Indexed drawing. template <class DrawMode> void draw(Context& context, DrawMode drawMode, @@ -58,31 +57,6 @@ public: }); } - // Unindexed drawing. - template <class DrawMode> - void draw(Context& context, - DrawMode drawMode, - DepthMode depthMode, - StencilMode stencilMode, - ColorMode colorMode, - UniformValues&& uniformValues, - const VertexBuffer<Vertex, DrawMode>& vertexBuffer, - const SegmentVector<Attributes>& segments) { - static_assert(std::is_same<Primitive, typename DrawMode::Primitive>::value, "incompatible draw mode"); - context.draw({ - std::move(drawMode), - std::move(depthMode), - std::move(stencilMode), - std::move(colorMode), - program, - vertexBuffer.buffer, - 0, - segments, - Uniforms::binder(uniformsState, std::move(uniformValues)), - Attributes::binder(attributesState) - }); - } - private: UniqueShader vertexShader; UniqueShader fragmentShader; diff --git a/src/mbgl/gl/segment.hpp b/src/mbgl/gl/segment.hpp index 0a735ababf..8f74afd237 100644 --- a/src/mbgl/gl/segment.hpp +++ b/src/mbgl/gl/segment.hpp @@ -33,13 +33,6 @@ template <class Attributes> class SegmentVector : public std::vector<Segment> { public: SegmentVector() = default; - - // This constructor is for unindexed rendering. It creates a SegmentVector with a - // single segment having 0 indexes. - template <class DrawMode> - SegmentVector(const VertexBuffer<typename Attributes::Vertex, DrawMode>& buffer) { - emplace_back(0, 0, buffer.vertexCount, 0); - } }; } // namespace gl |