]> git.tdb.fi Git - libs/gl.git/blobdiff - source/batch.cpp
Inherit Loaders from the ObjectLoader classes
[libs/gl.git] / source / batch.cpp
index df4e2fb828e0102989abd2ddacb069f59a33d3a9..33481a1cdfc8c613692f36de60e667e8413ed698 100644 (file)
@@ -5,8 +5,9 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
-#define GL_GLEXT_PROTOTYPES
 #include "batch.h"
+#include "extension.h"
+#include "vertexarray.h"
 
 using namespace std;
 
@@ -42,19 +43,24 @@ void Batch::append(const vector<uint> &ind)
 
 void Batch::draw() const
 {
-       glDrawRangeElements(type, min_index, max_index, indices.size(), GL_UNSIGNED_INT, &indices[0]);
+       draw_range_elements(type, min_index, max_index, indices.size(), &indices[0]);
+}
+
+void Batch::draw_with_buffer(unsigned offset) const
+{
+       draw_range_elements(type, min_index, max_index, indices.size(), (unsigned *)0+offset);
 }
 
 
 Batch::Loader::Loader(Batch &b):
-       batch(b)
+       DataFile::ObjectLoader<Batch>(b)
 {
        add("indices", &Loader::indices);
 }
 
 void Batch::Loader::indices(const vector<uint> &ind)
 {
-       batch.append(ind);
+       obj.append(ind);
 }
 
 } // namespace GL