Screen flicker issue

hi every developer
today i meet the issue about screen flicker and i solved.

issue link:(including sample movie)
[[http://www.cocos2d-iphone.org/forum/topic/14495]]

if someone meets the same issue.

just add blow in your project.
CCDirector::sharedDirector()->setDepthTest(false); ( in applicationDidFinishLaunching )

i don’t know what is setDepthTest, but it will lead screen flicker…

:wink:

Oh, it’s a “famous” case in cocos2d community. Riq wrote a blog describing this http://www.cocos2d-iphone.org/archives/1430. It only appears on ipad2.

I got this problem too on my Android tablet HTC Flyer. The textures are all like flickering in mili seconds. I’m using coocos2d-x 3.0alpha1.

Tried this on AppDelegate::applicactionDidFinishLaunching

Director::getInstance()->setDepthTest(false);
Director::getInstance()->setProjection(kCCDirectorProjection2D);

But no success, screen still flickering. Is this problem has already been fixed?

I designed the image in 480x800 resolution, then I hope it will be scaled up fine in my tablet, but it’s not. I tried in my android phone(480x800) and it goes fine.

This is the video how the flicker happens
https://dl.dropboxusercontent.com/u/42793494/flicker.mp4
or

It seems to be already fixed in 3.0beta. Flickers still happens though when changing scene.

Is there a clue where I could fix this on 3.0alpha1?

This seems like a serious problem not handled properly :frowning:

does anyone have the same problem too?

bump

I’ll just make a wild guess here guys :slight_smile:
If it’s all about the depth test, maybe it has an invariance issue or something between layers?
They might be fighting who’s in front or something bec. of small difference in depth?
I don’t know, i might be wrong.

@newstar55a
you’re logically correct, I’m trying to disable depth test and try to manually setting the depth for each sprite ( if possible )
But why it only happens on tablet (where scale up happens) and not on phone?

In this particular situation i honestly don’t know why but it could be on the available bit depth of the depth buffer. If we could just indulge in setting these we would like it deep of course but we are limited only to what available options there are on each and every platform.
It could also be on the issue of invariance in shaders where in you have the same depth variable calculation on both vertex and fragment shaders which you expect to have the same result but they have different output and so you have this z-fighting going on.
I dont know sir I was just guessing i might be wrong but these are concepts that may help point the real problem :slight_smile:

Flicker also occurs on other game made by cocos2d-x “Run Cow Run”. Just play the game and you will see flickers happen about every 10 seconds of gameplay.

Is there any clues on this?

I tried another game made with cocos2d-x “Clouds & Sheep” and it’s pretty smooth on my HTC Flyer without any flickering
02-26 15:25:29.415: D/cocos2d(26336): cocos2d: cocos2d v0.99.5-beta

@siauw hi guy can you give me a demo。I’ll fix it for you and can you tell me which version did you use it.
you can send the demo to “yuye.liu@chukong-inc.ocm”
thank you very much

It seems like if I add sprites to batch node using using z order, then flickers gone. maybe bug in the SpriteBatchNode?