I'm just working with some 2D stuff first, using draw2DImage.
When I use any of the copyToScaling functions, to enlarge a texture for example, my image gets distorted, though it becomes the correct size and all the extra pixels get created . It looks sort of rotated 45 degrees and it starts too far to the right and wraps around.
I can't upload an image at the moment.
Code: Select all
//! Create a temporary IImage of the texture, so we can copy (from) the pixels to create the transformed image/texture.
irr::video::IImage * image = pVideoDriver->createImageFromData(texture->getColorFormat(), irr::core::dimension2d<irr::u32>(textureFrame.getSize()), const_cast<irr::video::ITexture *>(texture)->lock() );
//! create a new scaled version of the IImage.
irr::video::IImage * scaledTransformedImage = pVideoDriver->createImage(texture->getColorFormat(), irr::core::dimension2d<irr::u32>(scaledTransformedFrame.getSize()));
image->copyToScalingBoxFilter(scaledTransformedImage);
//! unlock the texture.
const_cast<irr::video::ITexture *>(texture)->unlock();
this->m_pTransformedTexture =
pVideoDriver->addTexture( ((irr::core::stringc)texture->getName() += (irr::core::stringc)".png").c_str(), scaledTransformedImage);
//! drop the images.
image->drop();
scaledTransformedImage->drop();
The texture draws normally when not scaled.
Code: Select all
//! Draw the transformed texture.
pVideoDriver->draw2DImage(transformedTexture, ptDest);
It looks weird because I'm not applying any rotation, but after using the copyTo function, it's rotated and not aligned to the left.
I'm not sure what to do.