From a50bda090a37a8d60deee80a68eddcf0789b9c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:38:04 +0200 Subject: [PATCH] No need to have virtual destructor for AbstractTexture. Protected constructor and destructor is sufficient, AbstractTexture isn't meant to be used via AbstractTexture* anyway. --- src/AbstractTexture.cpp | 4 ++++ src/AbstractTexture.h | 31 +++++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) 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