From ef80006737d171b7f4976927b8c0f6e9e82d1c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 10 Dec 2011 00:05:12 +0100 Subject: [PATCH] Using GLint instead of GLsizei for offset. --- src/AbstractTexture.h | 8 +++--- src/CubeMapTexture.h | 58 +++++++++++++++++++++---------------------- src/Texture.h | 4 +-- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index fa778a169..41a019fac 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -244,7 +244,7 @@ class AbstractTexture { * Calls @c glTexSubImage1D, @c glTexSubImage2D, @c glTexSubImage3D * depending on dimension count. */ - inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data); + inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data); #endif }; @@ -261,7 +261,7 @@ template<> struct AbstractTexture::DataHelper<1> { glTexImage1D(target, mipLevel, static_cast(internalFormat), dimensions.at(0), 0, static_cast(colorFormat), type, data); } - inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { + inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { glTexSubImage1D(target, mipLevel, offset.at(0), dimensions.at(0), static_cast(colorFormat), type, data); } }; @@ -272,7 +272,7 @@ template<> struct AbstractTexture::DataHelper<2> { glTexImage2D(target, mipLevel, static_cast(internalFormat), dimensions.at(0), dimensions.at(1), 0, static_cast(colorFormat), type, data); } - inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { + inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { glTexSubImage2D(target, mipLevel, offset.at(0), offset.at(1), dimensions.at(0), dimensions.at(1), static_cast(colorFormat), type, data); } }; @@ -283,7 +283,7 @@ template<> struct AbstractTexture::DataHelper<3> { glTexImage3D(target, mipLevel, static_cast(internalFormat), dimensions.at(0), dimensions.at(1), dimensions.at(2), 0, static_cast(colorFormat), type, data); } - inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { + inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { glTexSubImage3D(target, mipLevel, offset.at(0), offset.at(1), offset.at(2), dimensions.at(0), dimensions.at(1), dimensions.at(2), static_cast(colorFormat), type, data); } }; diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index f028e0d93..e52c1fcf0 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -61,11 +61,11 @@ class CubeMapTexture: public Texture2D { /** @brief Deleted. Use @ref setDataPositiveX(GLint, InternalFormat, const Image*) "setDataPositiveX()" and others instead. */ void setData(GLint mipLevel, InternalFormat internalFormat, const Image* image) = delete; - /** @brief Deleted. Use @ref setSubDataPositiveX(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) "setSubDataPositiveX()" and others instead. */ - template inline void setSubData(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) = delete; + /** @brief Deleted. Use @ref setSubDataPositiveX(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) "setSubDataPositiveX()" and others instead. */ + template inline void setSubData(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) = delete; - /** @brief Deleted. Use @ref setSubDataPositiveX(GLint, const Math::Vector&, const Image*) "setSubDataPositiveX()" and others instead. */ - void setSubData(GLint mipLevel, const Math::Vector& offset, const Image* image) = delete; + /** @brief Deleted. Use @ref setSubDataPositiveX(GLint, const Math::Vector&, const Image*) "setSubDataPositiveX()" and others instead. */ + void setSubData(GLint mipLevel, const Math::Vector& offset, const Image* image) = delete; /** * @brief Set texture data for positive X @@ -88,18 +88,18 @@ class CubeMapTexture: public Texture2D { /** * @brief Set texture subdata for positive X * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) */ - template inline void setSubDataPositiveX(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { + template inline void setSubDataPositiveX(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { setSubData(GL_TEXTURE_CUBE_MAP_POSITIVE_X, mipLevel, offset, _dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); } /** * @brief Set texture subdata for positive X * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) */ - inline void setSubDataPositiveX(GLint mipLevel, const Math::Vector& offset, const Image* image) { + inline void setSubDataPositiveX(GLint mipLevel, const Math::Vector& offset, const Image* image) { setSubData(GL_TEXTURE_CUBE_MAP_POSITIVE_X, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); } @@ -124,18 +124,18 @@ class CubeMapTexture: public Texture2D { /** * @brief Set texture subdata for negative X * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) */ - template inline void setSubDataNegativeX(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { + template inline void setSubDataNegativeX(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { setSubData(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, mipLevel, offset, _dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); } /** * @brief Set texture subdata for negative X * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) */ - inline void setSubDataNegativeX(GLint mipLevel, const Math::Vector& offset, const Image* image) { + inline void setSubDataNegativeX(GLint mipLevel, const Math::Vector& offset, const Image* image) { setSubData(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); } @@ -160,18 +160,18 @@ class CubeMapTexture: public Texture2D { /** * @brief Set texture subdata for positive Y * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) */ - template inline void setSubDataPositiveY(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { + template inline void setSubDataPositiveY(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { setSubData(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, mipLevel, offset, _dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); } /** * @brief Set texture subdata for positive Y * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) */ - inline void setSubDataPositiveY(GLint mipLevel, const Math::Vector& offset, const Image* image) { + inline void setSubDataPositiveY(GLint mipLevel, const Math::Vector& offset, const Image* image) { setSubData(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); } @@ -196,18 +196,18 @@ class CubeMapTexture: public Texture2D { /** * @brief Set texture subdata for negative Y * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) */ - template inline void setSubDataNegativeY(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { + template inline void setSubDataNegativeY(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { setSubData(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, mipLevel, offset, _dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); } /** * @brief Set texture subdata for negative Y * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) */ - inline void setSubDataNegativeY(GLint mipLevel, const Math::Vector& offset, const Image* image) { + inline void setSubDataNegativeY(GLint mipLevel, const Math::Vector& offset, const Image* image) { setSubData(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); } @@ -232,18 +232,18 @@ class CubeMapTexture: public Texture2D { /** * @brief Set texture subdata for positive Z * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) */ - template inline void setSubDataPositiveZ(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { + template inline void setSubDataPositiveZ(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { setSubData(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, mipLevel, offset, _dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); } /** * @brief Set texture subdata for positive Z * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) */ - inline void setSubDataPositiveZ(GLint mipLevel, const Math::Vector& offset, const Image* image) { + inline void setSubDataPositiveZ(GLint mipLevel, const Math::Vector& offset, const Image* image) { setSubData(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); } @@ -268,18 +268,18 @@ class CubeMapTexture: public Texture2D { /** * @brief Set texture subdata for negative Z * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Math::Vector&, ColorFormat, const T*) */ - template inline void setSubDataNegativeZ(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { + template inline void setSubDataNegativeZ(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { setSubData(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, mipLevel, offset, _dimensions, colorFormat, TypeTraits::TextureType>::glType(), data); } /** * @brief Set texture subdata for negative Z * - * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) + * @copydetails Texture::setSubData(GLint, const Math::Vector&, const Image*) */ - inline void setSubDataNegativeZ(GLint mipLevel, const Math::Vector& offset, const Image* image) { + inline void setSubDataNegativeZ(GLint mipLevel, const Math::Vector& offset, const Image* image) { setSubData(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); } @@ -290,7 +290,7 @@ class CubeMapTexture: public Texture2D { unbind(); } - void setSubData(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { + void setSubData(GLenum target, GLint mipLevel, const Math::Vector& offset, const Math::Vector& dimensions, ColorFormat colorFormat, GLenum type, const void* data) { bind(); DataHelper::setSub(target, mipLevel, offset, dimensions, colorFormat, type, data); unbind(); diff --git a/src/Texture.h b/src/Texture.h index af58a7877..9e357b328 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -112,7 +112,7 @@ template class Texture: public AbstractTexture { * color channel is detected from format of passed data array. * @param data %Texture data */ - template inline void setSubData(GLint mipLevel, const Math::Vector& offset, const Math::Vector& _dimensions, ColorFormat colorFormat, const T* data) { + 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); unbind(); @@ -124,7 +124,7 @@ template class Texture: public AbstractTexture { * @param offset Offset where to put data in the texture * @param image Image */ - inline void setSubData(GLint mipLevel, const Math::Vector& offset, const Image* image) { + inline void setSubData(GLint mipLevel, const Math::Vector& offset, const Image* image) { bind(); DataHelper::setSub(target, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); unbind();