diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 76657184f..0ad26b57d 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -472,25 +472,11 @@ class MAGNUM_EXPORT AbstractTexture { * @param target %Target * @param mipLevel Mip level * @param internalFormat Internal texture format - * @param dimensions %Texture dimensions - * @param colorFormat Color format of passed data - * @param type Data type - * @param data %Texture data - * - * Calls `glTexImage1D`, `glTexImage2D`, `glTexImage3D` depending - * on dimension count. - */ - inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data); - - /** - * @brief Set texture data from image - * @param target %Target - * @param mipLevel Mip level - * @param internalFormat Internal texture format * @param image Image, BufferedImage or for example * Trade::ImageData of the same dimension count * - * Calls set() with image data. + * Calls `glTexImage1D`, `glTexImage2D`, `glTexImage3D` depending + * on dimension count. */ template inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, T* image); @@ -499,25 +485,11 @@ class MAGNUM_EXPORT AbstractTexture { * @param target %Target * @param mipLevel Mip level * @param offset Offset where to put data in the texture - * @param dimensions %Texture dimensions - * @param colorFormat Color format of passed data - * @param type Data type - * @param data %Texture data - * - * Calls `glTexSubImage1D`, `glTexSubImage2D`, `glTexSubImage3D` - * depending on dimension count. - */ - inline static void setSub(SubTarget target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data); - - /** - * @brief Set texture subdata from image - * @param target %Target - * @param mipLevel Mip level - * @param offset Offset where to put data in the texture * @param image Image, BufferedImage or for example * Trade::ImageData of the same dimension count * - * Calls setSub() with image data. + * Calls `glTexSubImage1D`, `glTexSubImage2D`, `glTexSubImage3D` + * depending on dimension count. */ template inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, T* image); #endif @@ -581,20 +553,12 @@ template<> struct AbstractTexture::DataHelper<1> { glTexParameteri(static_cast(target), GL_TEXTURE_WRAP_S, static_cast(wrapping.at(0))); } - inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data) { - glTexImage1D(static_cast(target), mipLevel, internalFormat, dimensions.at(0), 0, static_cast(colorFormat), static_cast(type), data); - } - template inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, T* image) { - set(target, mipLevel, internalFormat, image->dimensions(), image->colorFormat(), image->type(), image->data()); - } - - inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data) { - glTexSubImage1D(static_cast(target), mipLevel, offset.at(0), dimensions.at(0), static_cast(colorFormat), static_cast(type), data); + glTexImage1D(static_cast(target), mipLevel, internalFormat, image->dimensions().at(0), 0, static_cast(image->colorFormat()), static_cast(image->type()), image->data()); } template inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, T* image) { - setSub(target, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); + glTexSubImage1D(static_cast(target), mipLevel, offset.at(0), image->dimensions().at(0), static_cast(image->colorFormat()), static_cast(image->type()), image->data()); } }; template<> struct AbstractTexture::DataHelper<2> { @@ -618,20 +582,12 @@ template<> struct AbstractTexture::DataHelper<2> { glTexParameteri(static_cast(target), GL_TEXTURE_WRAP_T, static_cast(wrapping.at(1))); } - inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data) { - glTexImage2D(static_cast(target), mipLevel, internalFormat, dimensions.at(0), dimensions.at(1), 0, static_cast(colorFormat), static_cast(type), data); - } - template inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, T* image) { - set(target, mipLevel, internalFormat, image->dimensions(), image->colorFormat(), image->type(), image->data()); - } - - inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data) { - glTexSubImage2D(static_cast(target), mipLevel, offset.at(0), offset.at(1), dimensions.at(0), dimensions.at(1), static_cast(colorFormat), static_cast(type), data); + glTexImage2D(static_cast(target), mipLevel, internalFormat, image->dimensions().at(0), image->dimensions().at(1), 0, static_cast(image->colorFormat()), static_cast(image->type()), image->data()); } template inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, T* image) { - setSub(target, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); + glTexSubImage2D(static_cast(target), mipLevel, offset.at(0), offset.at(1), image->dimensions().at(0), image->dimensions().at(1), static_cast(image->colorFormat()), static_cast(image->type()), image->data()); } }; template<> struct AbstractTexture::DataHelper<3> { @@ -648,20 +604,12 @@ template<> struct AbstractTexture::DataHelper<3> { glTexParameteri(static_cast(target), GL_TEXTURE_WRAP_R, static_cast(wrapping.at(2))); } - inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data) { - glTexImage3D(static_cast(target), mipLevel, internalFormat, dimensions.at(0), dimensions.at(1), dimensions.at(2), 0, static_cast(colorFormat), static_cast(type), data); - } - template inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, T* image) { - set(target, mipLevel, internalFormat, image->dimensions(), image->colorFormat(), image->type(), image->data()); - } - - inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, Type type, const void* data) { - glTexSubImage3D(static_cast(target), mipLevel, offset.at(0), offset.at(1), offset.at(2), dimensions.at(0), dimensions.at(1), dimensions.at(2), static_cast(colorFormat), static_cast(type), data); + glTexImage3D(static_cast(target), mipLevel, internalFormat, image->dimensions().at(0), image->dimensions().at(1), image->dimensions().at(2), 0, static_cast(image->colorFormat()), static_cast(image->type()), image->data()); } template inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, T* image) { - setSub(target, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); + glTexSubImage3D(static_cast(target), mipLevel, offset.at(0), offset.at(1), offset.at(2), image->dimensions().at(0), image->dimensions().at(1), image->dimensions().at(2), static_cast(image->colorFormat()), static_cast(image->type()), image->data()); } }; #endif diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index ce5d61c2b..b5d4a47aa 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -64,20 +64,9 @@ class CubeMapTexture: public Texture2D { */ inline CubeMapTexture(GLint layer = 0): Texture(layer, Target::CubeMap) {} - template inline void setData(GLint mipLevel, InternalFormat internalFormat, const Math::Vector& dimensions, ColorFormat colorFormat, const T* data) = delete; template void setData(GLint mipLevel, InternalFormat internalFormat, T* image) = delete; - template inline void setSubData(GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, const T* data) = delete; template void setSubData(GLint mipLevel, const Math::Vector& offset, T* image) = delete; - /** - * @copydoc Texture::setData(GLint, InternalFormat, const Math::Vector&, ColorFormat, const T*) - * @param coordinate Coordinate - */ - template inline void setData(Coordinate coordinate, GLint mipLevel, InternalFormat internalFormat, const Math::Vector& dimensions, ColorFormat colorFormat, const T* data) { - bind(); - DataHelper::set(static_cast(coordinate), mipLevel, internalFormat, dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); - } - /** * @copydetails Texture::setData(GLint, InternalFormat, T*) * @param coordinate Coordinate @@ -87,15 +76,6 @@ class CubeMapTexture: public Texture2D { DataHelper::set(static_cast(coordinate), mipLevel, internalFormat, image); } - /** - * @copydoc Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) - * @param coordinate Coordinate - */ - template inline void setSubData(Coordinate coordinate, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, const T* data) { - bind(); - DataHelper::setSub(static_cast(coordinate), mipLevel, offset, dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); - } - /** * @copydoc Texture::setSubData(GLint, const Math::Vector&, T*) * @param coordinate Coordinate diff --git a/src/Texture.h b/src/Texture.h index 3ed51d670..40cd11073 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -82,22 +82,6 @@ template class Texture: public AbstractTexture { * @brief Set texture data * @param mipLevel Mip level * @param internalFormat Internal texture format - * @param dimensions %Texture dimensions - * @param colorFormat Color format of passed data. Data size per - * color channel is detected from format of passed data array. - * @param data %Texture data - * - * Sets texture from given data. The data are not deleted afterwards. - */ - template inline void setData(GLint mipLevel, InternalFormat internalFormat, const Math::Vector& dimensions, ColorFormat colorFormat, const T* data) { - bind(); - DataHelper::set(_target, mipLevel, internalFormat, dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); - } - - /** - * @brief Set texture data from image - * @param mipLevel Mip level - * @param internalFormat Internal texture format * @param image Image, BufferedImage or for example * Trade::ImageData of the same dimension count * @@ -113,23 +97,6 @@ template class Texture: public AbstractTexture { * @brief Set texture subdata * @param mipLevel Mip level * @param offset Offset where to put data in the texture - * @param dimensions %Texture dimensions - * @param colorFormat Color format of passed data. Data size per - * color channel is detected from format of passed data array. - * @param data %Texture data - * - * Sets texture subdata from given data. The data are not deleted - * afterwards. - */ - template inline void setSubData(GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, const T* data) { - bind(); - DataHelper::setSub(_target, mipLevel, offset, dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); - } - - /** - * @brief Set texture subdata from image - * @param mipLevel Mip level - * @param offset Offset where to put data in the texture * @param image Image, BufferedImage or for example * Trade::ImageData of the same dimension count *