Browse Source

No need to have virtual destructor for AbstractTexture.

Protected constructor and destructor is sufficient, AbstractTexture
isn't meant to be used via AbstractTexture* anyway.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
a50bda090a
  1. 4
      src/AbstractTexture.cpp
  2. 31
      src/AbstractTexture.h

4
src/AbstractTexture.cpp

@ -99,6 +99,10 @@ void AbstractTexture::move() {
_id = 0; _id = 0;
} }
AbstractTexture::AbstractTexture(GLenum target): _target(target) {
glGenTextures(1, &_id);
}
AbstractTexture::~AbstractTexture() { destroy(); } AbstractTexture::~AbstractTexture() { destroy(); }
AbstractTexture::AbstractTexture(AbstractTexture&& other): _target(other._target), _id(other._id) { AbstractTexture::AbstractTexture(AbstractTexture&& other): _target(other._target), _id(other._id) {

31
src/AbstractTexture.h

@ -107,20 +107,6 @@ class MAGNUM_EXPORT AbstractTexture {
*/ */
static Int maxSupportedLayerCount(); 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 */ /** @brief Copying is not allowed */
AbstractTexture(const AbstractTexture&) = delete; AbstractTexture(const AbstractTexture&) = delete;
@ -260,6 +246,23 @@ class MAGNUM_EXPORT AbstractTexture {
*/ */
AbstractTexture* generateMipmap(); 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 #ifdef DOXYGEN_GENERATING_OUTPUT
private: private:
#else #else

Loading…
Cancel
Save