From: Mikko Rasa Date: Fri, 28 Oct 2016 11:55:23 +0000 (+0300) Subject: Prefer explicit mipmap generation with glGenerateMipmap X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6f8c0c6c088be92804cb413c0234bfb817ef2d8d;p=libs%2Fgl.git Prefer explicit mipmap generation with glGenerateMipmap Implicit generation with the texture parameter was deprecated in OpenGL 3.0 and removed in OpenGL 3.2. --- 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<