[core] Fix debug rendering

* Off-by-one in DebugBucket indexing
* Must unbind VAO before binding index buffer in Context::createIndexBuffer
This commit is contained in:
John Firebaugh
2016-12-09 17:13:01 -08:00
parent 36616c7200
commit c12b52c6a7
2 changed files with 3 additions and 2 deletions

View File

@@ -105,6 +105,7 @@ UniqueBuffer Context::createIndexBuffer(const void* data, std::size_t size) {
BufferID id = 0;
MBGL_CHECK_ERROR(glGenBuffers(1, &id));
UniqueBuffer result { std::move(id), { this } };
vertexArrayObject = 0;
elementBuffer = result;
MBGL_CHECK_ERROR(glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, data, GL_STATIC_DRAW));
return result;

View File

@@ -46,8 +46,8 @@ DebugBucket::DebugBucket(const OverscaledTileID& id,
vertices.emplace_back(FillAttributes::vertex(p));
if (prev) {
indices.emplace_back(vertices.vertexSize() - 1,
vertices.vertexSize());
indices.emplace_back(vertices.vertexSize() - 2,
vertices.vertexSize() - 1);
}
prev = p;