X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture.cpp;h=c8a1371c5b0a7724effdeb33ec7f529e70372a47;hb=6afbace895a7bbcf216ab8e48280ea0303ab5892;hp=d22f189bdcad4cc0a3c0e2f7edb0d55f30c5adaf;hpb=2e7f19b895424c3a77940e648639f8df2b395d0f;p=libs%2Fgl.git diff --git a/source/texture.cpp b/source/texture.cpp index d22f189b..c8a1371c 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -1,5 +1,6 @@ #include #include "error.h" +#include "sgis_generate_mipmap.h" #include "texture.h" #include "texunit.h" @@ -8,27 +9,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())); } @@ -129,6 +125,8 @@ void Texture::set_wrap_r(TextureWrap w) void Texture::set_generate_mipmap(bool gm) { + if(gm) + static Require _req(SGIS_generate_mipmap); gen_mipmap = gm; update_parameter(GENERATE_MIPMAP); }