off-by-one issue in CCTransitionCrossFade

off-by-one issue in CCTransitionCrossFade
0.0 0


I’m using CCTransitionCrossFade to transition between two scenes. The background of the two scenes are identical except the former is a darker version of the latter. The backgrounds are the same image just the former has darker values for the colors of the pixels in the image. This way the crossfade transition appears visually as “turning on the lights”.

It works; however, I notice that when the transition ends the background image visually snaps to a size one pixel larger than it was during the transition. In other words, I think that in the logic of CCTransitionCrossFade there might be an off-by-one issue in which the textures are being rendered one-pixel too small.

This is seen in cocos2d-2.0-x-2.0.2 on iOS.


So if anyone else runs into this, I figured out what it was — or at least I figured out a work-around…

Basically in AppDelegate::applicationDidFinishLaunching() I need to do


The problem has nothing to do with CCTransitionCrossFade beyond the fact that the transition i was doing allowed me to notice subtle rendering artifacts. But these rendering artifacts were still there even without executing a cross fade. I think the issue has something to do with what is be discussed here:

I think there are still problems when using a fullscreen sprite as a background image on an iPad2 with the projection set to 3D.