max_index(0),
restart(false)
{
- /* XXX Should probably provide a fallback to glDrawElements since this class
- is pretty much required to render anything. */
- static Require _req(EXT_draw_range_elements);
}
Batch::~Batch()
}
Buffer *ibuf = get_buffer();
+ const void *data_ptr;
BindRestore _bind_ibuf(ibuf, ELEMENT_ARRAY_BUFFER);
if(ibuf)
{
if(dirty)
update_buffer();
- glDrawRangeElements(prim_type, min_index, max_index, size(), data_type, reinterpret_cast<void *>(get_offset()));
+ data_ptr = reinterpret_cast<const void *>(get_offset());
}
else
- glDrawRangeElements(prim_type, min_index, max_index, size(), data_type, &data[0]);
+ data_ptr = &data[0];
+
+ if(EXT_draw_range_elements)
+ glDrawRangeElements(prim_type, min_index, max_index, size(), data_type, data_ptr);
+ else
+ glDrawElements(prim_type, size(), data_type, data_ptr);
}