Hello Everyone,
I'm working on a program that imports various image formats and encodes them into one of several .pvr formats. Although argb8888, argb4444, rgb565, PVRTC2 and PVRTC4 work perfectly, when I encode an image in the argb1555 format all the alpha bytes in my pixel data are set to 0 when I call CompressPVR. This occurs for images that do and do not have transparancy. As you can guess, this makes the image a little useless as it is 100% transparent.
The pixel data is currently stored as an unsigned char* which is passed to the CPVRTexture when it is initialized. I'm calling setPixelType(MGLPT_ARGB_1555) to specify the format.
My code looks something like this...
// To Store the Raw Pixel Data
unsigned char* pixelData = new unsigned char;
// Allocate the memory needed for pixelData
pixelData = (unsigned char*) malloc(32*image.width*image.height);
// Write
image.writePixels(pixelData);
// get the utilities instance
PVRTextureUtilities *PVRU = PVRTextureUtilities::getPointer();
// make a CPVRTexture instance with data passed
CPVRTexture sOriginalTexture( image.width, image.height, 0, 1, false, false, false, false, false, true, false, eInt8StandardPixelType, 0.0f, pixelData);
// create texture to encode to
CPVRTexture sCompressedTexture(sOriginalTexture.getHeader());
// set required encoded pixel type
sCompressedTexture.setPixelType(MGLPT_ARGB_1555);
// encode texture
PVRU->CompressPVR(sOriginalTexture,sCompressedTexture);
// write to file specified
sCompressedTexture.writeToFile(outFile);
Can anyone explain to me what criteria CompressPVR uses to deturmine if an alpha bit is set to 1 or 0? Or if necessary, could anyone explain how to flip the alpha bits?
Thank you.