From 29723d09750ed51f75653cb3b9c9f5c8d9a0a6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 4 Jul 2012 22:31:10 +0200 Subject: [PATCH] Fixed texture subdata setters. Functions for setting 2D subimage of 3D texture / 1D subimage of 2D texture introduced in 728ddb19a3294e64feba6b600b8770580e3378fa weren't probably tested at all, as they are ambiguous overloads. Now using std::enable_if, which works. --- src/AbstractTexture.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 0202cc53b..97f6fbb3f 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -693,11 +693,11 @@ template<> struct AbstractTexture::DataHelper<1> { glTexParameteri(target, GL_TEXTURE_WRAP_S, static_cast(wrapping[0])); } - template inline static void set(GLenum target, GLint mipLevel, InternalFormat internalFormat, Image* image, const Math::Vector<1, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type set(GLenum target, GLint mipLevel, InternalFormat internalFormat, Image* image) { glTexImage1D(target, mipLevel, internalFormat, image->dimensions()[0], 0, static_cast(image->components()), static_cast(image->type()), image->data()); } - template inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector<1, GLint>& offset, Image* image, const Math::Vector<1, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type setSub(GLenum target, GLint mipLevel, const Math::Vector<1, GLint>& offset, Image* image) { glTexSubImage1D(target, mipLevel, offset[0], image->dimensions()[0], static_cast(image->components()), static_cast(image->type()), image->data()); } }; @@ -716,15 +716,15 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { static void setWrapping(GLenum target, const Math::Vector<2, Wrapping>& wrapping); - template inline static void set(GLenum target, GLint mipLevel, InternalFormat internalFormat, Image* image, const Math::Vector<2, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type set(GLenum target, GLint mipLevel, InternalFormat internalFormat, Image* image) { glTexImage2D(target, mipLevel, internalFormat, image->dimensions()[0], image->dimensions()[1], 0, static_cast(image->components()), static_cast(image->type()), image->data()); } - template inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector<2, GLint>& offset, Image* image, const Math::Vector<2, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type setSub(GLenum target, GLint mipLevel, const Math::Vector<2, GLint>& offset, Image* image) { glTexSubImage2D(target, mipLevel, offset[0], offset[1], image->dimensions()[0], image->dimensions()[1], static_cast(image->components()), static_cast(image->type()), image->data()); } - template inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector<2, GLint>& offset, Image* image, const Math::Vector<1, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type setSub(GLenum target, GLint mipLevel, const Math::Vector<2, GLint>& offset, Image* image) { glTexSubImage2D(target, mipLevel, offset[0], offset[1], image->dimensions()[0], 1, static_cast(image->components()), static_cast(image->type()), image->data()); } }; @@ -743,15 +743,15 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { static void setWrapping(GLenum target, const Math::Vector<3, Wrapping>& wrapping); #ifndef MAGNUM_TARGET_GLES - template inline static void set(GLenum target, GLint mipLevel, InternalFormat internalFormat, Image* image, const Math::Vector<3, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type set(GLenum target, GLint mipLevel, InternalFormat internalFormat, Image* image) { glTexImage3D(target, mipLevel, internalFormat, image->dimensions()[0], image->dimensions()[1], image->dimensions()[2], 0, static_cast(image->components()), static_cast(image->type()), image->data()); } - template inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector<3, GLint>& offset, Image* image, const Math::Vector<3, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type setSub(GLenum target, GLint mipLevel, const Math::Vector<3, GLint>& offset, Image* image) { glTexSubImage3D(target, mipLevel, offset[0], offset[1], offset[2], image->dimensions()[0], image->dimensions()[1], image->dimensions()[2], static_cast(image->components()), static_cast(image->type()), image->data()); } - template inline static void setSub(GLenum target, GLint mipLevel, const Math::Vector<3, GLint>& offset, Image* image, const Math::Vector<2, GLsizei>& = (Math::Vector())) { + template inline static typename std::enable_if::type setSub(GLenum target, GLint mipLevel, const Math::Vector<3, GLint>& offset, Image* image) { glTexSubImage3D(target, mipLevel, offset[0], offset[1], offset[2], image->dimensions()[0], image->dimensions()[1], 1, static_cast(image->components()), static_cast(image->type()), image->data()); } #endif