From 6c48b12a3f2a4b383e2a38f496712c76e564d237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 2 Jul 2015 17:05:51 -0700 Subject: [PATCH] Fixed issue #447. --- src/renderer_gl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 5c869a97..afcbdb46 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -5707,6 +5707,7 @@ namespace bgfx { namespace gl { const IndexBufferGL& ib = m_indexBuffers[draw.m_indexBuffer.idx]; const bool hasIndex16 = 0 == (ib.m_flags & BGFX_BUFFER_INDEX32); + const uint32_t indexSize = hasIndex16 ? 2 : 4; const GLenum indexFormat = hasIndex16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT @@ -5714,7 +5715,6 @@ namespace bgfx { namespace gl if (UINT32_MAX == draw.m_numIndices) { - const uint32_t indexSize = hasIndex16 ? 2 : 4; numIndices = ib.m_size/indexSize; numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub; numInstances = draw.m_numInstances; @@ -5737,7 +5737,7 @@ namespace bgfx { namespace gl GL_CHECK(glDrawElementsInstanced(prim.m_type , numIndices , indexFormat - , (void*)(uintptr_t)(draw.m_startIndex*2) + , (void*)(uintptr_t)(draw.m_startIndex*indexSize) , draw.m_numInstances ) ); }