X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fimmediate.cpp;h=cf1be08ed7204209d0d572b851ce76b7c58469ff;hp=3d808d320897d9c1610ebf2da3650d56e7859d94;hb=8bc776f177c7cf9d0c6fd9590273f086d38c23ca;hpb=85c82f93f4874bcf0b04332c9abb62cd2a5b181b diff --git a/source/immediate.cpp b/source/immediate.cpp index 3d808d32..cf1be08e 100644 --- a/source/immediate.cpp +++ b/source/immediate.cpp @@ -1,10 +1,5 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include "batch.h" +#include "error.h" #include "immediate.h" namespace Msp { @@ -14,24 +9,28 @@ Immediate::Immediate(VertexFormat f): PrimitiveBuilder(array), array(f) { - array.use_vertex_buffer(0); + array.use_buffer(0); } void Immediate::reset() { if(in_batch) - throw InvalidState("Can't reset Immediate between begin() and end()"); + throw invalid_operation("Immediate::reset"); 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)