Note that there are some explanatory texts on larger screens.

plurals
  1. POInserting an OpenGL layer in front of a UIView with controls
    text
    copied!<p>I'm trying to use OpenGLES animation layer in front of a UIView which contains controls. For example, I want to render animation in FRONT of the UIButton (so animated objects pass in front of (occluding) the button from view as they pass).</p> <p>Haven't been able to find an answer despite several related threads. </p> <p>My primary view controller has one view in it, of type GLKView. I have a separate xib (View.xib) which contains one UIView with one UIButton in it.</p> <p><strong>Within my viewDidLoad, I have:</strong></p> <pre><code>self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; if (!self.context) { NSLog(@"Failed to create ES context"); } GLKView *glView = (GLKView *)self.view; glView.context = self.context; glView.drawableDepthFormat = GLKViewDrawableColorFormatRGB565; glView.opaque = NO; glView.alpha = 1.0; glView.backgroundColor = [UIColor clearColor]; UIView *controlView = [[[NSBundle mainBundle]loadNibNamed:@"View" owner:self options:nil] objectAtIndex:0]; controlView.frame = CGRectMake(100,200,100,100); controlView.backgroundColor = [UIColor greenColor]; controlView.alpha = 1; controlView.opaque = YES; CALayer *controlViewLayer = controlView.layer; [controlViewLayer insertSublayer:glView.layer above:controlViewLayer]; [self setupGL]; </code></pre> <p>Within <strong>drawInRect</strong> I have: glClearColor(0,0,0,0);</p> <p>The result is that my GLKView animation renders with a black/clear background, but I cannot see my UIView containing the button.</p> <p>Any ideas? Thanks, Dave</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload