X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Ftexture.cpp;h=967a7fe31562d8509619b3bef3d060c3bd75d714;hp=354c1b12d5307b53113c0ae7080f2635c3e0f3a9;hb=fcde8390ad577fe434dcd4b29e0f410d29f867c9;hpb=7f0e08f04536bf42b8f64e7dff5cc3e18b916c7b diff --git a/source/core/texture.cpp b/source/core/texture.cpp index 354c1b12..967a7fe3 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "bindable.h" #include "error.h" @@ -55,6 +56,11 @@ void Texture::generate_id() glCreateTextures(target, 1, &id); else glGenTextures(1, &id); + +#ifdef DEBUG + if(!debug_name.empty() && KHR_debug) + glObjectLabel(GL_TEXTURE, id, debug_name.size(), debug_name.c_str()); +#endif } void Texture::set_format(PixelFormat fmt) @@ -277,6 +283,17 @@ void Texture::unbind_from(unsigned i) } } +void Texture::set_debug_name(const string &name) +{ +#ifdef DEBUG + debug_name = name; + if(id && KHR_debug) + glObjectLabel(GL_TEXTURE, id, name.size(), name.c_str()); +#else + (void)name; +#endif +} + Texture::Loader::Loader(Texture &t): DataFile::CollectionObjectLoader(t, 0)