Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 589
Daniel Avatar asked Nov 29 '25 22:11

Daniel


2 Answers

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.

like image 199
Brad Larson Avatar answered Dec 01 '25 10:12

Brad Larson


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

like image 45
Greg Avatar answered Dec 01 '25 10:12

Greg