X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fimmediate.cpp;h=15d3a634a13248063efd29c2f5889fff7110c120;hb=249ce48a66074d0f0b6e23caeb77fad7c3d238ae;hp=a387d71b4b283eac45dcd47148dad9e6581fb321;hpb=76e338af116120d93d082ad247591ec9adad9233;p=libs%2Fgl.git diff --git a/source/immediate.cpp b/source/immediate.cpp index a387d71b..15d3a634 100644 --- a/source/immediate.cpp +++ b/source/immediate.cpp @@ -5,6 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include "batch.h" #include "immediate.h" namespace Msp { @@ -13,7 +14,9 @@ namespace GL { Immediate::Immediate(VertexFormat f): PrimitiveBuilder(array), array(f) -{ } +{ + array.use_vertex_buffer(0); +} void Immediate::reset() { @@ -21,15 +24,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)