diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 44fbc5c51..b4134c49e 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -99,6 +99,10 @@ void AbstractTexture::move() { _id = 0; } +AbstractTexture::AbstractTexture(GLenum target): _target(target) { + glGenTextures(1, &_id); +} + AbstractTexture::~AbstractTexture() { destroy(); } AbstractTexture::AbstractTexture(AbstractTexture&& other): _target(other._target), _id(other._id) { diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index e4b13f069..422086634 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -107,20 +107,6 @@ class MAGNUM_EXPORT AbstractTexture { */ static Int maxSupportedLayerCount(); - #ifndef DOXYGEN_GENERATING_OUTPUT - explicit AbstractTexture(GLenum target): _target(target) { - glGenTextures(1, &_id); - } - #endif - - /** - * @brief Destructor - * - * Deletes assigned OpenGL texture. - * @see @fn_gl{DeleteTextures} - */ - virtual ~AbstractTexture() = 0; - /** @brief Copying is not allowed */ AbstractTexture(const AbstractTexture&) = delete; @@ -260,6 +246,23 @@ class MAGNUM_EXPORT AbstractTexture { */ AbstractTexture* generateMipmap(); + protected: + /** + * @brief Constructor + * + * Creates new OpenGL texture. + * @see @fn_gl{GenTextures} + */ + explicit AbstractTexture(GLenum target); + + /** + * @brief Destructor + * + * Deletes assigned OpenGL texture. + * @see @fn_gl{DeleteTextures} + */ + ~AbstractTexture(); + #ifdef DOXYGEN_GENERATING_OUTPUT private: #else