Transparent areas PVR textures loading white in cocos2d
-
26-05-2021 - |
Question
I'm loading a large number of PVR texures in cocos2d in an iOS app, but the transparent areas of the PVR textures are loading white.
I've created the textures using the command texturetool -e PVRTC -o $file.pvr -f PVR $file
The textures seem to show transparency when viewed in the TexturePacker app.
Is there something I need to set in cocos2d to make these work? Or do I need to run texturetool with different flags?
Solution
Maybe "premultiply alpha" helps. This is a checkbox in TexturePacker, found in the left pane at the bottom under "Advanced".
Hover over this checkbox to get more information. In particular you'll need to enable premultiplied alpha in cocos2d with
[CCTexture2D PVRImagesHavePremultipliedAlpha:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow