X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fbatch.cpp;fp=source%2Fcore%2Fbatch.cpp;h=68e232ba29de5447fd9050d27894000f2765e86f;hp=f14cc307ff71b92deb212e9f759ac70f1c8d69f0;hb=efb45a6851563cdb8077b6aad3ab92d4006d8790;hpb=4fb346536bfefd612635a248f558b1f1471deae6 diff --git a/source/core/batch.cpp b/source/core/batch.cpp index f14cc307..68e232ba 100644 --- a/source/core/batch.cpp +++ b/source/core/batch.cpp @@ -55,6 +55,7 @@ unsigned Batch::restart_index = 0; Batch::Batch(PrimitiveType t): prim_type(t), index_type(UNSIGNED_SHORT), + gl_index_type(get_gl_type(index_type)), max_index(0), restart(false) { } @@ -76,6 +77,7 @@ void Batch::set_index_type(DataType t) shrink(data); index_type = t; + gl_index_type = get_gl_type(t); update_offset(); dirty = true; } @@ -189,7 +191,7 @@ void Batch::draw() const BindRestore _bind_ibuf(get_buffer(), ELEMENT_ARRAY_BUFFER); const void *data_ptr = setup_draw(); - glDrawElements(prim_type, size(), index_type, data_ptr); + glDrawElements(prim_type, size(), gl_index_type, data_ptr); } void Batch::draw_instanced(unsigned count) const @@ -199,7 +201,7 @@ void Batch::draw_instanced(unsigned count) const BindRestore _bind_ibuf(get_buffer(), ELEMENT_ARRAY_BUFFER); const void *data_ptr = setup_draw(); - glDrawElementsInstanced(prim_type, size(), index_type, data_ptr, count); + glDrawElementsInstanced(prim_type, size(), gl_index_type, data_ptr, count); } const void *Batch::setup_draw() const