X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture.cpp;h=7ae1a2c2c5bda0e171e6f2ad171646afac48eab5;hb=48fc090a59a5ff5c3f06ffe1acfe77b06dad2a86;hp=f4e7d705d142332652396160bb144009aa6c0364;hpb=10b5a32fef9f63254a54378a879142793975efe0;p=libs%2Fgl.git diff --git a/source/texture.cpp b/source/texture.cpp index f4e7d705..7ae1a2c2 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -1,11 +1,5 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include "except.h" +#include +#include "error.h" #include "texture.h" #include "texunit.h" @@ -14,27 +8,22 @@ using namespace std; namespace Msp { namespace GL { -istream &operator>>(istream &in, TextureFilter &tf) +void operator>>(const LexicalConverter &c, TextureFilter &tf) { - string str; - in>>str; - - if(str=="NEAREST") + if(c.get()=="NEAREST") tf = NEAREST; - else if(str=="LINEAR") + else if(c.get()=="LINEAR") tf = LINEAR; - else if(str=="NEAREST_MIPMAP_NEAREST") + else if(c.get()=="NEAREST_MIPMAP_NEAREST") tf = NEAREST_MIPMAP_NEAREST; - else if(str=="NEAREST_MIPMAP_LINEAR") + else if(c.get()=="NEAREST_MIPMAP_LINEAR") tf = NEAREST_MIPMAP_LINEAR; - else if(str=="LINEAR_MIPMAP_NEAREST") + else if(c.get()=="LINEAR_MIPMAP_NEAREST") tf = LINEAR_MIPMAP_NEAREST; - else if(str=="LINEAR_MIPMAP_LINEAR") + else if(c.get()=="LINEAR_MIPMAP_LINEAR") tf = LINEAR_MIPMAP_LINEAR; else - in.setstate(ios_base::failbit); - - return in; + throw lexical_error(format("conversion of '%s' to TextureFilter", c.get())); } @@ -47,7 +36,7 @@ void operator>>(const LexicalConverter &c, TextureWrap &tw) else if(c.get()=="MIRRORED_REPEAT") tw = MIRRORED_REPEAT; else - throw LexicalError("Invalid input in TextureWrap conversion"); + throw lexical_error(format("conversion of '%s' to TextureWrap", c.get())); } @@ -153,9 +142,6 @@ void Texture::set_compare_func(Predicate f) void Texture::bind() const { - if(!target) - throw InvalidState("Attempt to bind a texture without target (should never happen)"); - const Texture *cur = TexUnit::current().get_texture(); if(cur!=this) {