X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbatch.cpp;h=f14cc307ff71b92deb212e9f759ac70f1c8d69f0;hb=344dd6a52b55d847f3346e94ec266a8864764b9d;hp=64187eedb123aff7bdcef7d41fb5d67f8327f44b;hpb=a2a00bdc96a7d2aa4c95c5a125c0c438147d7495;p=libs%2Fgl.git diff --git a/source/batch.cpp b/source/batch.cpp index 64187eed..f14cc307 100644 --- a/source/batch.cpp +++ b/source/batch.cpp @@ -204,6 +204,9 @@ void Batch::draw_instanced(unsigned count) const const void *Batch::setup_draw() const { + if(!get_buffer()) + throw invalid_operation("Batch::setup_draw"); + if(restart) { unsigned index = (index_type==UNSIGNED_INT ? 0xFFFFFFFF : 0xFFFF); @@ -214,14 +217,9 @@ const void *Batch::setup_draw() const else if(restart_index && restart_index<=max_index) set_restart_index(0); - if(get_buffer()) - { - refresh(); + refresh(); - return reinterpret_cast(get_offset()); - } - else - return &data[0]; + return reinterpret_cast(get_offset()); } void Batch::set_restart_index(unsigned index)