Making your iOS OpenGLES view transparent

At some point you may want to make your OpenGL ES view transparent, so you can display something else behind it. (Maybe a camera view?) For this article, I’m going to assume you are using a Game project template from XCode 6.

In your GameViewController.m’s viewDidLoad function, just before the ‘[self setupGL];’ call, add the following lines:

    view.backgroundColor=[UIColor clearColor];
    
    CAEAGLLayer *eaglLayer=(CAEAGLLayer*)self.view.layer;
    eaglLayer.opaque=NO;

Also, in the glkView:drawInRect function, change the glClearColor line to be all zeroes:

    glClearColor(0.00f, 0.00f, 0.00f, 0.0f);

That should be it.