]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.cpp
Do not attempt to legacy-bind texture targets which do not support it
[libs/gl.git] / source / texture.cpp
index 1b7bdc2297ec3a1be84d95fdcd091b55b59bae20..820dd10fd90318c64278ae9b0aed66cf227d8743 100644 (file)
@@ -314,6 +314,8 @@ void Texture::bind_to(unsigned i, bool legacy) const
                }
        }
 
+       legacy = (legacy && is_legacy_target(target));
+
        TexUnit &unit = TexUnit::get_unit(i);
        const Texture *old = unit.get_texture();
        bool old_legacy = unit.get_texture_legacy();
@@ -369,6 +371,11 @@ void Texture::unbind_from(unsigned i)
        }
 }
 
+bool Texture::is_legacy_target(GLenum target)
+{
+       return target<GL_TEXTURE_1D_ARRAY;
+}
+
 
 Texture::Loader::Loader(Texture &t):
        DataFile::CollectionObjectLoader<Texture>(t, 0)