X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprimitivebuilder.cpp;h=dd869908d9240df76b2f48a2308a0396613a35ad;hp=61bde9b96f8862881deb00e0719564dae1b08549;hb=d713e5391dc5d85759c7aab36f6df7a85c3d8eff;hpb=df6f8f1f26b1f230dcb1d626d278c43fd48d468d diff --git a/source/primitivebuilder.cpp b/source/primitivebuilder.cpp index 61bde9b9..dd869908 100644 --- a/source/primitivebuilder.cpp +++ b/source/primitivebuilder.cpp @@ -1,12 +1,8 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2008, 2010-2011 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include "error.h" #include "primitivebuilder.h" +using namespace std; + namespace Msp { namespace GL { @@ -20,7 +16,7 @@ PrimitiveBuilder::PrimitiveBuilder(VertexArray &a): void PrimitiveBuilder::begin(PrimitiveType t) { if(in_batch) - throw InvalidState("begin() already called"); + throw invalid_operation("PrimitiveBuilder::begin"); type = t; in_batch = true; @@ -31,7 +27,7 @@ void PrimitiveBuilder::begin(PrimitiveType t) void PrimitiveBuilder::end() { if(!in_batch) - throw InvalidState("end() called without begin()"); + throw invalid_operation("PrimitiveBuilder::end"); in_batch = false; @@ -41,23 +37,23 @@ void PrimitiveBuilder::end() void PrimitiveBuilder::offset(unsigned o) { if(o>array.size()) - throw InvalidParameterValue("Element offset out of range"); + throw out_of_range("PrimitiveBuilder::offset"); offs = o; } void PrimitiveBuilder::element(unsigned i) { if(!in_batch) - throw InvalidState("Element specification not between begin() and end()"); + throw invalid_operation("PrimitiveBuilder::element"); if(offs+i>=array.size()) - throw InvalidParameterValue("Element index out of range"); + throw out_of_range("PrimitiveBuilder::element"); element_(offs+i); } PrimitiveType PrimitiveBuilder::get_type() const { if(!in_batch) - throw InvalidState("Not between begin() and end()"); + throw invalid_operation("PrimitiveBuilder::get_type"); return type; }