1

My iOS application stops rendering in case if the GLKView drawableMultisample is GLKViewDrawableMultisample4X. Everything works fine with the GLKViewDrawableMultisampleNone but if I set it to GLKViewDrawableMultisample4X, so I get only blank pink screen.

I've checked it on the iOS Simulator / iOS 7.0.3

Is anybody know how to resolve this issue ? Is it may be related to the iOS simulator and may work good on the real device?

Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70

1 Answers1

0

I was having exactly this issue. It's not clear if the cause is the same but, in my case I was triggering my render from a displayLink trigger - without any regard for the semantics of setNeedsDisplay, or how GLKit sets up the render buffer around the execution of the drawInRect method.

I was of the mindset that since I was using displayLink, I could run all my rendering directly off of that trigger - and since it all worked before I tried to set up anti-aliasing, i figured it couldn't be far wrong!

The problem only manifested when I set GLKViewDrawableMultisample4X, much like the OP's problem.

The solution...

  1. Ensure the view is created with enableSetNeedsDisplay = NO
  2. Have displayLink trigger a function that contains nothing more than the following:
- (void)render:(CADisplayLink*)displayLink {

    // This function should *not* perform any rendering
    // We only want to inform GLKit that we're ready to render

    GLKView * view = [self.window.subviews objectAtIndex:0];

    // Tell GLKit that we're ready to draw
    [view display];

    // GLKit will ensure the buffers are setup before 
    // calling drawInRect
}
  1. Move all rendering into drawInRect. GLKit will ensure the buffers are setup before drawInRect is called.
Tim Kane
  • 2,599
  • 3
  • 20
  • 19