Transparency in PNGs not working

Forums Programming cocos2d Mac Transparency in PNGs not working

This topic contains 2 replies, has 1 voice, and was last updated by  TimK 2 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
Author Posts
Author Posts
October 6, 2011 at 10:41 pm #235879

TimK
@timk

Hi,

I’m currently noodling around with a mac based project with cocos2d 0.99.5. I’ve just noticed that pngs with transparency aren’t being rendered properly. The transparent parts of the sprite is being rendered as black. These PNGs work fine in the ios 0.99.5.

I’m wondering whether I’m missing a setting in the scene or sprite init. (BTW I’ve used the wizard to setup the project).

I’ve tried running the following as before creating the sprite but it doesn’t seem to help.

[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];

Anyone got any ideas?

Regards

Tim

October 12, 2011 at 10:30 pm #350342

TimK
@timk

So after more noodling I’ve established that the transparency issue occurs when I add an IKImageBrowser to the app. I’m thinking that the CA layer in the image browser is somehow interfering with MacGLview. I’ve tried the image browser in different panels and windows but it still seems to be problematic.

October 12, 2011 at 10:45 pm #350343

TimK
@timk

Okay got it sorted. If I check the “Wants Core Animation Layer” on the image browser then the transparency works in the MacGLView. I’m not sure why this is, I would have thought it would be the reverse, doesn’t the MacGl view make use of the CA layer to render/animate? Or is it because they are both being rendered in the CALayer the system can reconcile whatever the conflict was?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.