From: Mikko Rasa Date: Sat, 30 Nov 2013 16:56:42 +0000 (+0200) Subject: Tweak buffer logic a bit in Batch::draw X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=00fddb7f46bf0164f74a99f8f5f0081ce969260a;p=libs%2Fgl.git Tweak buffer logic a bit in Batch::draw Excplicitly binding the buffer first avoids unnecessary implicit binds in the buffer update code. --- diff --git a/source/batch.cpp b/source/batch.cpp index 34bd83c0..09a6a611 100644 --- a/source/batch.cpp +++ b/source/batch.cpp @@ -245,14 +245,14 @@ void Batch::draw() const restart_index = 0; } - if(get_buffer()) + if(Buffer *ibuf = get_buffer()) { + BufferAlias alias(*ibuf); + Bind bind_ibuf(alias, true); + if(dirty) update_buffer(); - BufferAlias alias(*get_buffer()); - Bind bind_ibuf(alias, true); - glDrawRangeElements(prim_type, min_index, max_index, size(), data_type, reinterpret_cast(get_offset())); } else