开发者

Why is my OpenGL ES view sometimes blank on iOS 4.3?

My app "Guess-A-Sketch" has drawing issues in ios 4.3. I have a gl drawing canvas that shows up black. The odd thing is I found if I adjust the frame size of the ogl view slightly it seems to work.. the 开发者_开发百科version I have in the appstore doesn't work so I have to do an update to fix.. though it seems like a bug. Anyone else seeing this? Very annoying! even with my frame adjustment fix the view flickers black when I have animated transforms on the view which was smooth in previous ios versions


You may be encountering an issue that is mentioned in this answer. In iOS 4.2, the way that renderbuffers were handled has been changed to improve performance. From the OpenGL ES Programming Guide:

In iOS 4.2 and later, the performance of Core Animation rotations of renderbuffers have been significantly improved, and are now the preferred way to rotate content between landscape and portrait mode. For best performance, ensure the renderbuffer’s height and width are each a multiple of 32 pixels.

On iOS 4.2, there was a bug where non-multiple-of-32 OpenGL ES renderbuffer sizes simply showed up as black under the Simulator (but worked fine on the device). Given that your content appears correctly at some sizes, but not others, you may be running into a related issue.

In any case, you'll want to make sure your renderbuffers are now even multiples of 32 for best performance anyway.


I suspect that the same thing is happening to me, my application was working on 4.2.2 but it has estrange behaviours in 4.3. I draw images in a 'openGL view' that is a subview os a UIScrollView, sometimes the image is black until it gets a pinch-in or pinch-out gesture, sometimes while the image is resizing in a zoom, it leaves a black border where the image was drawed the instant before, also sometimes the image scrolls fine inside the scrolling view but others it becomes black and does not follow the scroll. None of those things happen in 4.3 devices.

Thanks for your time. Greg


I agree with Brad that the black background sounds like the 32 bug, but the flickering doesn't... Maybe you could try setting Raintained backing to true. That may help.

In OpenGLES2DView.m:

eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];


I had the same problem, and it was driving me crazy.

To fix it, I simply specified a backgroundColor for my Open GL view. I have no idea how this thing works, here, but it did solved this problem for me.

Hope it can helps.

By the way, this specific problem seems to be fixed on iOS 5.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜