]> git.tdb.fi Git - libs/gl.git/blobdiff - source/batch.cpp
Reset viewport also after pass-specific effects
[libs/gl.git] / source / batch.cpp
index d650fda8b6c3576cf3605d0f632f4d0faf17200f..e522491144f1a7f6a06a0329e5c8e1721b241e69 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;
 
@@ -19,7 +20,7 @@ Batch::Batch(PrimitiveType t):
        max_index(0)
 { }
 
-void Batch::append(uint i)
+Batch &Batch::append(uint i)
 {
        if(indices.empty())
                min_index=max_index=i;
@@ -29,6 +30,8 @@ void Batch::append(uint i)
                max_index=max(max_index, i);
        }
        indices.push_back(i);
+
+       return *this;
 }
 
 void Batch::append(const vector<uint> &ind)
@@ -40,7 +43,12 @@ 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);
 }