X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture.cpp;h=4efa8ac998ad4ab80a3a6fa57a531b9d15422c18;hb=9b430dbef4f58a862320ebfcef7d1f8bff28b0dc;hp=fd14458553417d2b5d2b0dc71d036e2434f9efbf;hpb=0221e39a685c4f3122a0fae032a7888b5ce40579;p=libs%2Fgl.git diff --git a/source/texture.cpp b/source/texture.cpp index fd144585..4efa8ac9 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -100,7 +100,7 @@ void Texture::update_parameter(int mask) const if(mask&MAG_FILTER) glTexParameteri(target, GL_TEXTURE_MAG_FILTER, mag_filter); if(mask&MAX_ANISOTROPY) - glTexParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy); + glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy); if(mask&WRAP_S) glTexParameteri(target, GL_TEXTURE_WRAP_S, wrap_s); if(mask&WRAP_T) @@ -172,21 +172,18 @@ void Texture::set_wrap_r(TextureWrap w) void Texture::set_generate_mipmap(bool gm) { - if(gm) + if(gm && !EXT_framebuffer_object) static Require _req(SGIS_generate_mipmap); gen_mipmap = gm; - if(get_gl_api()!=OPENGL_ES2) + if(!EXT_framebuffer_object) update_parameter(GENERATE_MIPMAP); } void Texture::auto_generate_mipmap() { - if(get_gl_api()==OPENGL_ES2) - { - // glGenerateMipmap is defined here - static Require _req(EXT_framebuffer_object); + // glGenerateMipmap is defined here + if(EXT_framebuffer_object) glGenerateMipmap(target); - } } void Texture::set_compare_enabled(bool c) @@ -364,5 +361,12 @@ void Texture::Loader::wrap_t(TextureWrap w) obj.set_wrap_t(w); } + +bool is_mipmapped(TextureFilter filter) +{ + return (filter==NEAREST_MIPMAP_NEAREST || filter==NEAREST_MIPMAP_LINEAR || + filter==LINEAR_MIPMAP_NEAREST || filter==LINEAR_MIPMAP_LINEAR); +} + } // namespace GL } // namespace Msp