summaryrefslogtreecommitdiff
path: root/src/renderer/line_bucket.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-02-05 18:06:16 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-02-05 18:06:16 +0100
commite30d8eb48f89367f27a138fda5fdf41b78200e6c (patch)
treea10d185a85a55179f2582730a5a9fb01b2b2a1af /src/renderer/line_bucket.cpp
parent0a053d944a0d8ff8373f8091c9738e68080d34eb (diff)
downloadqtlocation-mapboxgl-e30d8eb48f89367f27a138fda5fdf41b78200e6c.tar.gz
move to vertex array objects
Diffstat (limited to 'src/renderer/line_bucket.cpp')
-rw-r--r--src/renderer/line_bucket.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/renderer/line_bucket.cpp b/src/renderer/line_bucket.cpp
index 70f766d9d7..5dc0710b8d 100644
--- a/src/renderer/line_bucket.cpp
+++ b/src/renderer/line_bucket.cpp
@@ -3,6 +3,7 @@
#include <llmr/geometry/geometry.hpp>
#include <llmr/renderer/painter.hpp>
+#include <llmr/renderer/shader-line.hpp>
#include <llmr/style/style.hpp>
#include <llmr/map/vector_tile.hpp>
@@ -264,14 +265,23 @@ void LineBucket::render(Painter& painter, const std::string& layer_name, const T
painter.renderLine(*this, layer_name, id);
}
-uint32_t LineBucket::size() const {
+size_t LineBucket::size() const {
return length;
}
-void LineBucket::bind() {
- buffer->bind();
+void LineBucket::bind(LineShader& shader) {
+ if (!array) {
+ char *vertex_index = BUFFER_OFFSET(start * 4 * sizeof(int16_t));
+ array.setup(shader, *buffer, vertex_index);
+ } else {
+ array.bind();
+ }
+}
+
+void LineBucket::drawLines() {
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, length);
}
-char *LineBucket::vertexOffset() const {
- return BUFFER_OFFSET(start * 4 * sizeof(int16_t));
+void LineBucket::drawPoints() {
+ glDrawArrays(GL_POINTS, 0, length);
}