Hello,
I've got an EAGLContext drawing into a CAEAGLLayer (via the standard GLGravityView example in the iPhone SDK).
What I'm trying to do is place my view on top of another view and use what I render in OpenGL to mask the underlying view.
Let's say the bottom view is a picture of a flower and I put my OpenGL view on top and I set the OpenGL clear-color to opaque black and then render my sphere. I want the sphere to cut through the black, exposing only a circular section of the flower picture. Even better would be to show both the sphere (as translucent) and the flower, cutting through the black.
I've called
glView.backgroundColor = [UIColor clearColor];
glClearColor(0.0, 0.0, 0.0, 1.0);
when I set up the view the and called
glColor4f( 1.0, 1.0, 1.0, 0.5 );
just before rendering the sphere.
It just makes the sphere off-white and doesn't show the underlying flower. I'm not too surprised by this.
Does anyone know how to create a mask instead?
Thank you for your help.