X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbatch.cpp;h=af1d243e6cba1551e6be65255a55e69a4e7029cf;hp=a59fad99f03b988309ef60042324df71ebf3c6ab;hb=b0059bd068c99dadfc922584911fcb25a21b737b;hpb=f50822b9e73a6ecdacbc4af4c4d9aba435a72386 diff --git a/source/batch.cpp b/source/batch.cpp index a59fad99..af1d243e 100644 --- a/source/batch.cpp +++ b/source/batch.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -235,6 +236,16 @@ void Batch::draw() const glDrawElements(prim_type, size(), data_type, data_ptr); } +void Batch::draw_instanced(unsigned count) const +{ + static Require req(ARB_draw_instanced); + + BindRestore _bind_ibuf(get_buffer(), ELEMENT_ARRAY_BUFFER); + const void *data_ptr = setup_draw(); + + glDrawElementsInstanced(prim_type, size(), data_type, data_ptr, count); +} + const void *Batch::setup_draw() const { if(restart)