#include <msp/gl/extensions/arb_draw_instanced.h>
-#include <msp/gl/extensions/ext_draw_range_elements.h>
#include <msp/gl/extensions/msp_primitive_restart.h>
#include "batch.h"
#include "bindable.h"
Batch::Batch(PrimitiveType t):
prim_type(t),
data_type(UNSIGNED_BYTE),
- min_index(0),
max_index(0),
restart(false)
{ }
void Batch::append_index(unsigned i)
{
if(data.empty())
- min_index = max_index = i;
+ max_index = i;
else
- {
- min_index = min(min_index, i);
max_index = max(max_index, i);
- }
if((data_type==UNSIGNED_BYTE || data_type==UNSIGNED_SHORT) && max_index>0xFFFE)
set_data_type(UNSIGNED_INT);
BindRestore _bind_ibuf(get_buffer(), ELEMENT_ARRAY_BUFFER);
const void *data_ptr = setup_draw();
- 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);
+ glDrawElements(prim_type, size(), data_type, data_ptr);
}
void Batch::draw_instanced(unsigned count) const