]> git.tdb.fi Git - libs/gl.git/blobdiff - source/immediate.cpp
Drop Id tags and copyright notices from files
[libs/gl.git] / source / immediate.cpp
index a387d71b4b283eac45dcd47148dad9e6581fb321..252eed335895e21f3dd5087f03a97f1cfcadac00 100644 (file)
@@ -1,10 +1,4 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include "batch.h"
 #include "immediate.h"
 
 namespace Msp {
@@ -13,7 +7,9 @@ namespace GL {
 Immediate::Immediate(VertexFormat f):
        PrimitiveBuilder(array),
        array(f)
-{ }
+{
+       array.use_vertex_buffer(0);
+}
 
 void Immediate::reset()
 {
@@ -21,15 +17,19 @@ void Immediate::reset()
                throw InvalidState("Can't reset Immediate between begin() and end()");
 
        array.clear();
+}
+
+void Immediate::begin_()
+{
        indices.clear();
 }
 
 void Immediate::end_()
 {
+       Batch batch(type);
+       batch.append(indices);
        array.apply();
-       draw_elements(type, indices.size(), &indices[0]);
-
-       indices.clear();
+       batch.draw();
 }
 
 void Immediate::element_(unsigned i)