From 6f8c0c6c088be92804cb413c0234bfb817ef2d8d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 28 Oct 2016 14:55:23 +0300 Subject: [PATCH] Prefer explicit mipmap generation with glGenerateMipmap Implicit generation with the texture parameter was deprecated in OpenGL 3.0 and removed in OpenGL 3.2. --- source/texture.cpp | 11 ++++------- source/texture1d.cpp | 9 ++++++--- source/texture2d.cpp | 9 ++++++--- source/texture3d.cpp | 9 ++++++--- source/texturecube.cpp | 9 ++++++--- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/source/texture.cpp b/source/texture.cpp index b528ca30..fe27a04d 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -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) diff --git a/source/texture1d.cpp b/source/texture1d.cpp index 44e49f51..e5a496a4 100644 --- a/source/texture1d.cpp +++ b/source/texture1d.cpp @@ -61,9 +61,9 @@ void Texture1D::image(unsigned level, PixelFormat fmt, DataType type, const void BindRestore _bind(this); if(ARB_texture_storage) - sub_image(level, 0, w, fmt, type, data); - else - glTexImage1D(target, level, ifmt, w, 0, fmt, type, data); + return sub_image(level, 0, w, fmt, type, data); + + glTexImage1D(target, level, ifmt, w, 0, fmt, type, data); allocated |= 1<