+void Batch::append(const Batch &other)
+{
+ if(other.prim_type!=prim_type)
+ throw invalid_argument("Batch::append");
+ if(prim_type==LINE_STRIP || prim_type==LINE_LOOP)
+ throw incompatible_data("Batch::append");
+ else if(prim_type==POLYGON)
+ throw incompatible_data("Batch::append");
+ else if(prim_type==TRIANGLE_FAN)
+ static Require _req(NV_primitive_restart);
+
+ if(other.data.empty())
+ return;
+
+ if(NV_primitive_restart)
+ {
+ restart = true;
+ if(data_type==UNSIGNED_SHORT)
+ ::append<unsigned short>(data, 0xFFFF);
+ else if(data_type==UNSIGNED_INT)
+ ::append<unsigned>(data, 0xFFFFFFFF);
+ else
+ data.push_back(0xFF);
+ }
+ else if(prim_type==TRIANGLE_STRIP)
+ {
+ append(get_index(size()-1));
+ append(other.get_index(0));
+ if(size()&1)
+ append(other.get_index(0));
+ }
+ else if(prim_type==QUAD_STRIP)
+ {
+ append(get_index(size()-1));
+ append(get_index(size()-1));
+ append(other.get_index(0));
+ append(other.get_index(0));
+ }
+
+ unsigned count = other.size();
+ for(unsigned i=0; i<count; ++i)
+ append(other.get_index(i));
+}
+
+void Batch::upload_data() const