Imagination PowerVR SDK Blog

resize problem



hi all,

i got a problem while calling the function pvrtexture::Resize in PVRTexLib.lib

code here:

pvrtexture theTexture( filename );
pvrtexture::Resize( theTexture, Width, Height, theTexture.getHeader().getDepth(), pvrtexture::EResizeMode::eResizeNearest );

pvrtexture::PixelType PVRTC4BPP( ePVRTPF_PVRTCI_4bpp_RGBA ); // Compress to PVRTC 4bpp.
pvrtexture::Transcode( theTexture, PVRTC4BPP, ePVRTVarTypeUnsignedInteger, ePVRTCSpacelRGB );
theTexture.saveFile(  sTheDstFilename.c_str() ); // Save the file

but the resize function return false;
is there anything i should set before Resize??

but Resize in PVRTexTool.exe works well.

besides, there seems some flaw appear while read dds file into the pvrtextool gui version, looks like black spots,
but TGA file doesn’t, any idea will be grateful!


Hi Jjay,

TexTool will automatically decompress an image to a standard format before it works on it. TexLib simply loads it into memory, so you’ll need to transcode it to a standard format before working on it  - (See: PVRTextureFormat.h which contains identifiers for standard formats, which need to be used alongside unsigned, normalised variable types. E.g.
 “Transcode( theTexture, PVRStandard8PixelType, ePVRTVarTypeUnsignedByteNorm, ePVRTCSpacelRGB );”).

Once you’ve done this it should work assuming the texture load worked alright - this can be checked by calling “theTexture.getTextureFormat()” which will be equal to “ePVRTPF_NumCompressedPFs” if it’s invalid.

As for the DDS files - this is a bug in previous versions with the dxt decompression routine - if you update to the latest version on the website this issue has been fixed.




Thanks for your reply, its useful!