[core] Use indexed rendering everywhere

This commit is contained in:
John Firebaugh
2016-11-21 13:03:31 -08:00
parent b1068b432e
commit 54c557d982
11 changed files with 84 additions and 111 deletions

View File

@@ -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)));
}
}