]> git.tdb.fi Git - libs/gl.git/commitdiff
Default to mipmapped filtering if EXT_framebuffer_object is available
authorMikko Rasa <tdb@tdb.fi>
Thu, 29 Dec 2016 09:41:03 +0000 (11:41 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 29 Dec 2016 09:41:03 +0000 (11:41 +0200)
Even if SGIS_generate_mipmap isn't.  The latter functionality has been
removed from modern OpenGL.

source/resources.cpp
source/texture.cpp
source/texture.h

index 6f5b0712c1e4a2a403e39b9823ed6577afadc0d8..db01b30badee3eca568eb5e11d5062b03c79670e 100644 (file)
@@ -1,6 +1,5 @@
 #include <msp/datafile/builtinsource.h>
 #include <msp/fs/utils.h>
-#include <msp/gl/extensions/sgis_generate_mipmap.h>
 #include "animation.h"
 #include "armature.h"
 #include "font.h"
@@ -27,7 +26,7 @@ namespace GL {
 void init_shaderlib(DataFile::BuiltinSource &);
 
 Resources::Resources():
-       default_tex_filter(SGIS_generate_mipmap ? LINEAR_MIPMAP_LINEAR : LINEAR),
+       default_tex_filter(Texture::can_generate_mipmap() ? LINEAR_MIPMAP_LINEAR : LINEAR),
        srgb_conversion(false),
        resource_manager(0)
 {
index 18746e5f2ecad265652b12804c2ec927e5d13fcd..185ed7feea582b53194e7a7a61183845b576f065 100644 (file)
@@ -243,6 +243,11 @@ void Texture::set_wrap_r(TextureWrap w)
        update_parameter(WRAP_R);
 }
 
+bool Texture::can_generate_mipmap()
+{
+       return (EXT_framebuffer_object || SGIS_generate_mipmap);
+}
+
 void Texture::set_generate_mipmap(bool gm)
 {
        if(gm && !EXT_framebuffer_object)
index abccb8d8122de9db6519fff679232d9923392715..9c43b76911ecb5d00fcf517847f6a04001ed6241 100644 (file)
@@ -163,6 +163,8 @@ public:
        void set_wrap_t(TextureWrap);
        void set_wrap_r(TextureWrap);
 
+       static bool can_generate_mipmap();
+
        /** Sets automatic mipmap generation.  If enabled, mipmaps are generated
        when a texture image is uploaded. */
        void set_generate_mipmap(bool);