I would be very surprised if this was a bug in the graphical chip. It's much more likely that it is a bug in apple's OpenGL implementation for the iPad 2. The only thing you can do is wait until apple addresses the problem in a new iOS version.
Screen flicker on iPad 2
(90 posts) (31 voices)-
Posted 1 year ago #
-
So what should we not implement in game till the apple solves problem.
1. Camra Action / Orbit Camera action
2. setVertexZ
3. Flipping Transitionscan we use flipX=YES or flipY=YES ? Am i right >?
correct me if i wrong anywhere, because i dont have iPad2 yet...
Posted 1 year ago # -
Z fighting – on the iPad 2 only – is not surprising, because the iPad 2 is the first device with the A5 processor. The A5 is the first processor in an iOS device which has two ARM cores. It is also the first processor in an iOS device which has two graphics cores. (See AnandTech's "Apple iPad 2 Preview".)
Multiple processors raises the possibility of random-order execution (between two threads). Fraught with peril. The software must take care to avoid this. So I would guess there's a significant amount of new code which is supposed to make sure there is no random-order execution when it would change the output. They only need to mess up on one of those to create something like Z fighting. And race conditions are notoriously hard to find.
Posted 1 year ago # -
araker: My guess is it's a problem in the OpenGL drivers which are developped by ImgTec. But they might not give support directly to us though, but through Apple.
riq: I suppose the OpenGL ES 2.0 forum would be a good place to file a bug. They might redirect you to deal with Apple instead, but it's worth a try.
Posted 1 year ago # -
oh and I don't think ImgTec has a bug tracker available for us
Posted 1 year ago # -
@recyclops:
Are you a developer ? If so, could you post that video on this thread ?
If you are not a developer, could you contact the authors of that App regarding the bug ? Also, tell them to report the bug in this thread too.https://devforums.apple.com/message/414331
Thanks.
@vlad2048:
I'll try there. thanks.@max9xs:
This issue happens when:
- You use a 3D projection (2D projection is bug free)
- AND GL_DEPTH_TEST is enabled (it is enabled by cocos2d when you set the 3D projection)
- AND and you are using a depth buffer buffer (eg: GL_DEPTH_COMPONENT24_OES or GL_DEPTH_COMPONENT16_OES) (0 depth buffer is bug free)
- AND you render "big" images. According to my tests the bug doesn't happen with "small" images... but this is not a scientific test.So, if you need a 3d projection + depth buffer for some effects or transitions, you can enable/disable the "depth test" in runtime, just before these effects/transitions happen:
// enable [director setDepthTest: YES]; // disable [director setDepthTest: NO];Posted 1 year ago # -
@riq, I was was setting projection to 2d in my AppDelegate. In one scene I use 3d flip, so I set projection to 3d on init and then back to 2d on dealloc. Should I still manually run set setDepthTest as well? I don't see where setting the projection calls it.
Posted 1 year ago # -
Posted 1 year ago #
-
@riq
Cool. Im not a dev. I wrote to the app developers but they dont have a support email...just an address for artist wanting to promote on their app.
Posted 1 year ago # -
Is there any update on this? We're getting close to release and this bug is quite ugly. I enable/disable the buffer when I can, but one of the primary transitions in the app is a page turn white requires it. Are there any work-arounds, patches, or anything else available or in the works?
Posted 10 months ago # -
cocos2d (and other apps) were using this "undefined" feature of open gl. Technically it is not an opengl bug (please see this thread: http://www.imgtec.com/forum/forum_posts.asp?TID=1256&PID=4255 )
So my suggestion is: use a 2d projection. When you need to apply a 3d effect, switch to a 3d projection. Once the 3d effect is finished, switch back to a 2d projection.
Posted 10 months ago # -
@returnZero, I don't know if this is what you're experiencing but this may help, check my problem/solution: http://www.cocos2d-iphone.org/forum/topic/18335?replies=1#post-102875
Posted 10 months ago # -
@riq the issue is that when I switch to a 3D projection anything that's animating on the screen during the transition looks terrible. Once I switch back to 2D it's all fine. It's just during that transition that it looks bad. So does this mean that 3D projections will forever be broken in Cocos2d on the iPad 2?
@Codebrella I'm not sure which sprite I would set the vertexZ to, as pretty much all the moving sprites on the screen do this flickering.
Posted 10 months ago # -
@ReturnZero: yes, 3d projections with depth buffer > 0 might trigger the bug.
Posted 10 months ago # -
Unless this doesn't do what I think it does...
director.projection = kCCDirectorProjection2D;
Then we are seeing it with 2D projection as well. :/
Posted 10 months ago # -
I was runnig some tests on my new app, and i notice this bug . I made up a "solution" to those who, like me, would like to use CCTransitionPageTurn. Instead switch setDepthTest On and Off on each scene, i put it on CCTransitionPageTurn. That's what i did:
1- On the very first scene of you app set setDepthTest off on init method ;
2- i made this modification on CCTransitionPageTurn.
#import "CCTransitionPageTurn.h" #import "CCActionPageTurn3D.h" #import "CCDirector.h" @implementation CCTransitionPageTurn /** creates a base transition with duration and incoming scene */ +(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s backwards:(BOOL) back { return [[[self alloc] initWithDuration:t scene:s backwards:back] autorelease]; } /** initializes a transition with duration and incoming scene */ -(id) initWithDuration:(ccTime) t scene:(CCScene*)s backwards:(BOOL) back { //Enable DepthTest to make transition THIS IS NOT A DEFAULT SETTING <-PUT THIS [[CCDirector sharedDirector] setDepthTest:YES]; // XXX: needed before [super init] back_ = back; if( ( self = [super initWithDuration:t scene:s] ) ) { // do something } return self; } -(void) sceneOrder { inSceneOnTop_ = back_; } //Disable DepthTest THIS IS NOT A DEFAULT METHOD <-PUT THIS -(void)swapDepthTest { [[CCDirector sharedDirector] setDepthTest:NO]; } -(void) onEnter { [super onEnter]; CGSize s = [[CCDirector sharedDirector] winSize]; int x, y; if( s.width > s.height) { x = 16; y = 12; } else { x = 12; y = 16; } id action = [self actionWithSize:ccg(x,y)]; //Disable DepthTest as part of action THIS IS NOT A DEFAULT ACTION <- PUT THIS id actionSwap = [CCCallFunc actionWithTarget:self selector:@selector(swapDepthTest)]; if(! back_ ) { [outScene_ runAction: [CCSequence actions: action, [CCCallFunc actionWithTarget:self selector:@selector(finish)], [CCStopGrid action], actionSwap, //Added to action sequence<- PUT THIS nil] ]; } else { // to prevent initial flicker inScene_.visible = NO; [inScene_ runAction: [CCSequence actions: [CCShow action], action, [CCCallFunc actionWithTarget:self selector:@selector(finish)], [CCStopGrid action],actionSwap, //Added to action sequence nil] ]; } }This is it, I hope this can help somebody
Diogo
Posted 7 months ago # -
I'm having this issue on iPhone 4S with Cocos 1.0.1
Disabling depth test fixes the issue. Not sure this is still relevant.
Posted 3 months ago # -
I have put setDepthTest:YES / setDepthTest:NO around CCTransitionPageTurn and it worked for iPad2. But for iPhone4S it does not - I can still see the flickering. Anyone tried to fix CCTransitionPageTurn using setVertexZ ?
Posted 2 months ago # -
So I'm trying to find solution using VectorZ but it did not work yet. May be I have wrong understanding of cocos/objective c? I assume that setting VertexZ in a parent object automatically propagates this property value to all children, right? But it seems that it does not because the parent does not flicker but the children do.
For a forward page turn case I simply do
currentPageScene.VertexZ = 0.0f
nextPageScene.VertexZ = -5.0f
// here do page turn transformationThe hierarchy is as follows:
Scene
-> Layer
-> SpritesI would expect setting Z coordinate to Scene will cause setting it to all sprites, is it right?
Posted 1 month ago # -
Riq, thanks - your answer made me think again and look into source code in more details. I'm not sure this is a bug, I just see that implementation is missing at this point. CCNode has no recursive setVertexZ method for its children, so setting the value to CCScene or CCLayer object does not cause calling setVertexZ of the sprite. I did see transformation code in CCNode using this value so with my limited OpenGL knowledge this might reach the same effect.
So did you mean the transformation code should do the work or it's still necessary to set VertexZ for each sprite?
P.S. I will do tests on device tomorrow anyway.
Posted 1 month ago # -
For those who might fight with the similar problem: I have finally found the way to completely avoid artifacts during PageTurn3D transition on iPad2/iPhone4S.
- add custom method to my PageLayer (derived from CCLayer) which would go through all children (sprites) and set vertex Z with an incremental offset (first sprite would have Z depth, second Z + 0.001, third Z + 0.002 etc). Thus we "overwrite" the painter method used by cocos
- before transition, call this method for the "above" page with Z = 0.0, call method for the "below" layer with Z = -1.0That's all !
P.S. Outside of PageTurn transition, the 2d Projection is active, so Z value has no impact
Posted 1 month ago # -
Actually I use exactly the children order, as the cocos rearranges children array by zOrder changes, it also properly handles zOrder. I slightly enhanced algorithm away from using fixed step between sprites but rather assign a "depth share" to the layer and the latter calculates the depth share pro each sprite. It works really fine, but I still have an unwanted effect on particular sprite configuration so I have ask again for help because I do not understand what happens.
I have 2 overlapped sprites, both zOrder =0, which gradually transform one into another (simply synchronously reducing opacity by first and increase opacity by the second). That means at any point of time there are 2 visible sprites with different opacity level. In 2D projection it works as expected.
Now when I turn page (switching to 3D), these sprites blink shortly <- this is the unwanted effect.
Before applying the page turn transformation their vertexZ is set to different values, so one would be located over another but I have no idea how it could cause blinking effect (even on normal device, not iPhone4S/iPad2).
Posted 1 month ago # -
You are probably starring, and the problem is a completely different one.
Posted 1 month ago # -
This might be indeed what happens. Finally I just gained to get rid of this effect by specifying different zOrder for both sprites. I still do not understand how it causes blinking but I give up at this point. It works now - that what matters. Thanks all!
Posted 1 month ago # -
Just wanted to share important point if someone will try to implement my solution described above: make sure you have enough Z value difference between neighbor sprites. Roughly it worked for me if I had first sign after point difference, like -1.4 and -1.5. Lesser difference (second or third sign) is not enough - it exceeds depth buffer precision and you get artefacts. Tested with both 16 Bit and 24 Bit depth buffer.
Posted 1 month ago # -
Hello,
I don't understand (I'm a noob yet) why if appear triangles (depthFormat:0) works ok on all devices? Maybe is possible to resolve de problem without change depthFormat on EAGLView? Actually I have the solution proposed for @diogo_gc and depthFormat:GL_DEPTH_COMPONENT16_OES into delegate, that's work into ipod,ipad1/2,iphone4 but doesn't work into iphone4S or iPad3 (desactivate retina display).
I'm working with cocos2d v1.1.0-beta2b, on iPad3 (activate retina display) I have this problem http://www.cocos2d-iphone.org/forum/topic/31059
Thanks in advance
Posted 3 weeks ago #
Reply
You must log in to post.