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

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Daniel
  • 1,317
  • 2
  • 11
  • 21

4 Answers4

2

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.

Community
  • 1
  • 1
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
  • Thanks for the help, I'll give this a try. I'm guessing the flickering is that my transform is an animated scale on the view so as it's scaleing it's passing through some bad sizes? Didn't happen in previous versions of the os, just 4.3. I'll try the suggestions for speed though on the final resulting size. – Daniel Mar 22 '11 at 04:39
1

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

Greg
  • 23
  • 1
  • 5
  • I forgot to say that this behaviour happens with images of every size, also when my frame buffers are multiple of 32, but in this case I would say that the black images are less usual, it also could be paranoia... – Greg Jun 09 '11 at 08:37
0

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];
Beaker
  • 1,633
  • 13
  • 22
  • Just to add an update. I looked and already has the above property set. I get the whole multiples of 32 but my case sounds different. I define a buffer size and then based on user action I scale and transform that view around using the 'transform' property. So I'm not changing the initial frame size, just scaling what's there. I did find I had to add little fudge factors on each transform to find a size that didn't render black and that worked. By again during the animated transform of the view I see drawing artifacts and flickering. – Daniel Mar 24 '11 at 14:33
0

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.

Vincent Tourraine
  • 801
  • 14
  • 23