+ max_index(0),
+ restart(false)
+{
+ /* Make sure we have glEnable/DisableClientState to go with
+ NV_primitive_restart */
+ if(NV_primitive_restart)
+ (bool)MSP_legacy_features;
+}
+
+Batch::~Batch()
+{
+}
+
+void Batch::set_data_type(DataType t)
+{
+ if(t!=UNSIGNED_BYTE && t!=UNSIGNED_SHORT && t!=UNSIGNED_INT)
+ throw invalid_argument("Batch::set_data_type");
+ if(t==UNSIGNED_BYTE && max_index>0xFE)
+ throw invalid_operation("Batch::set_data_type");
+ else if(t==UNSIGNED_SHORT && max_index>0xFFFE)
+ throw invalid_operation("Batch::set_data_type");
+
+ if(data_type==UNSIGNED_BYTE && t==UNSIGNED_SHORT)
+ expand<unsigned char, unsigned short>(data);
+ else if(data_type==UNSIGNED_BYTE && t==UNSIGNED_INT)
+ expand<unsigned char, unsigned>(data);
+ else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_INT)
+ expand<unsigned short, unsigned>(data);
+ else if(data_type==UNSIGNED_INT && t==UNSIGNED_BYTE)
+ shrink<unsigned, unsigned char>(data);
+ else if(data_type==UNSIGNED_INT && t==UNSIGNED_SHORT)
+ shrink<unsigned, unsigned short>(data);
+ else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_BYTE)
+ shrink<unsigned short, unsigned char>(data);
+
+ data_type = t;
+ update_offset();
+ dirty = true;
+}