|
|
|
|
@ -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<GLsizei, textureDimensions>& 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<class T> 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<GLint, textureDimensions>& offset, const Math::Vector<GLsizei, textureDimensions>& 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<class T> inline static void setSub(Target target, GLint mipLevel, const Math::Vector<GLint, textureDimensions>& offset, T* image); |
|
|
|
|
#endif |
|
|
|
|
@ -581,20 +553,12 @@ template<> struct AbstractTexture::DataHelper<1> {
|
|
|
|
|
glTexParameteri(static_cast<GLenum>(target), GL_TEXTURE_WRAP_S, static_cast<GLint>(wrapping.at(0))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, 1>& dimensions, ColorFormat colorFormat, Type type, const void* data) { |
|
|
|
|
glTexImage1D(static_cast<GLenum>(target), mipLevel, internalFormat, dimensions.at(0), 0, static_cast<GLenum>(colorFormat), static_cast<GLenum>(type), data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> 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<GLint, 1>& offset, const Math::Vector<GLsizei, 1>& dimensions, ColorFormat colorFormat, Type type, const void* data) { |
|
|
|
|
glTexSubImage1D(static_cast<GLenum>(target), mipLevel, offset.at(0), dimensions.at(0), static_cast<GLenum>(colorFormat), static_cast<GLenum>(type), data); |
|
|
|
|
glTexImage1D(static_cast<GLenum>(target), mipLevel, internalFormat, image->dimensions().at(0), 0, static_cast<GLenum>(image->colorFormat()), static_cast<GLenum>(image->type()), image->data()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> inline static void setSub(Target target, GLint mipLevel, const Math::Vector<GLint, 1>& offset, T* image) { |
|
|
|
|
setSub(target, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); |
|
|
|
|
glTexSubImage1D(static_cast<GLenum>(target), mipLevel, offset.at(0), image->dimensions().at(0), static_cast<GLenum>(image->colorFormat()), static_cast<GLenum>(image->type()), image->data()); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
template<> struct AbstractTexture::DataHelper<2> { |
|
|
|
|
@ -618,20 +582,12 @@ template<> struct AbstractTexture::DataHelper<2> {
|
|
|
|
|
glTexParameteri(static_cast<GLenum>(target), GL_TEXTURE_WRAP_T, static_cast<GLint>(wrapping.at(1))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, 2>& dimensions, ColorFormat colorFormat, Type type, const void* data) { |
|
|
|
|
glTexImage2D(static_cast<GLenum>(target), mipLevel, internalFormat, dimensions.at(0), dimensions.at(1), 0, static_cast<GLenum>(colorFormat), static_cast<GLenum>(type), data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> 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<GLint, 2>& offset, const Math::Vector<GLsizei, 2>& dimensions, ColorFormat colorFormat, Type type, const void* data) { |
|
|
|
|
glTexSubImage2D(static_cast<GLenum>(target), mipLevel, offset.at(0), offset.at(1), dimensions.at(0), dimensions.at(1), static_cast<GLenum>(colorFormat), static_cast<GLenum>(type), data); |
|
|
|
|
glTexImage2D(static_cast<GLenum>(target), mipLevel, internalFormat, image->dimensions().at(0), image->dimensions().at(1), 0, static_cast<GLenum>(image->colorFormat()), static_cast<GLenum>(image->type()), image->data()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> inline static void setSub(Target target, GLint mipLevel, const Math::Vector<GLint, 2>& offset, T* image) { |
|
|
|
|
setSub(target, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); |
|
|
|
|
glTexSubImage2D(static_cast<GLenum>(target), mipLevel, offset.at(0), offset.at(1), image->dimensions().at(0), image->dimensions().at(1), static_cast<GLenum>(image->colorFormat()), static_cast<GLenum>(image->type()), image->data()); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
template<> struct AbstractTexture::DataHelper<3> { |
|
|
|
|
@ -648,20 +604,12 @@ template<> struct AbstractTexture::DataHelper<3> {
|
|
|
|
|
glTexParameteri(static_cast<GLenum>(target), GL_TEXTURE_WRAP_R, static_cast<GLint>(wrapping.at(2))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, 3>& dimensions, ColorFormat colorFormat, Type type, const void* data) { |
|
|
|
|
glTexImage3D(static_cast<GLenum>(target), mipLevel, internalFormat, dimensions.at(0), dimensions.at(1), dimensions.at(2), 0, static_cast<GLenum>(colorFormat), static_cast<GLenum>(type), data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> 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<GLint, 3>& offset, const Math::Vector<GLsizei, 3>& dimensions, ColorFormat colorFormat, Type type, const void* data) { |
|
|
|
|
glTexSubImage3D(static_cast<GLenum>(target), mipLevel, offset.at(0), offset.at(1), offset.at(2), dimensions.at(0), dimensions.at(1), dimensions.at(2), static_cast<GLenum>(colorFormat), static_cast<GLenum>(type), data); |
|
|
|
|
glTexImage3D(static_cast<GLenum>(target), mipLevel, internalFormat, image->dimensions().at(0), image->dimensions().at(1), image->dimensions().at(2), 0, static_cast<GLenum>(image->colorFormat()), static_cast<GLenum>(image->type()), image->data()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> inline static void setSub(Target target, GLint mipLevel, const Math::Vector<GLint, 3>& offset, T* image) { |
|
|
|
|
setSub(target, mipLevel, offset, image->dimensions(), image->colorFormat(), image->type(), image->data()); |
|
|
|
|
glTexSubImage3D(static_cast<GLenum>(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<GLenum>(image->colorFormat()), static_cast<GLenum>(image->type()), image->data()); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
#endif |
|
|
|
|
|