From: Mikko Rasa Date: Sun, 1 Jul 2018 09:53:08 +0000 (+0300) Subject: Do not attempt to legacy-bind texture targets which do not support it X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=7af837734a28a14b3e24a421187d12ecd16572d0 Do not attempt to legacy-bind texture targets which do not support it --- diff --git a/source/texture.cpp b/source/texture.cpp index 1b7bdc22..820dd10f 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -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(t, 0) diff --git a/source/texture.h b/source/texture.h index f491297d..ffc5e1a4 100644 --- a/source/texture.h +++ b/source/texture.h @@ -202,7 +202,10 @@ public: static const Texture *current(unsigned = 0); static void unbind() { unbind_from(0); } static void unbind_from(unsigned); +private: + static bool is_legacy_target(GLenum); +public: virtual UInt64 get_data_size() const { return 0; } };