X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture.cpp;h=7ae1a2c2c5bda0e171e6f2ad171646afac48eab5;hb=4c5ba8f7d3bc755d6256cb6bf75907a1b10fc290;hp=c2ea8ff7b854c95cf6bee17e5bfd43aed772f710;hpb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8;p=libs%2Fgl.git diff --git a/source/texture.cpp b/source/texture.cpp index c2ea8ff7..7ae1a2c2 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -1,4 +1,5 @@ -#include "except.h" +#include +#include "error.h" #include "texture.h" #include "texunit.h" @@ -7,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())); } @@ -40,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())); } @@ -146,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) {