In my app, I have an equalizer with a visualizer behind it.
The equalizer is a series of dots which are imageviews with a path drawn between them using Quartz 2D (also with tick marks on the bottom and left to denote the frequency and gain amounts). Behind that is a visualizer done using OpenGL with a CAEAGLLayer.
The way this is set up is there is a sub view of my view controller's main view that handles the visualizer, and above that is another subview of the main view that draws the path. Above both of them are the image views for the eq points.
What happens is, the path draws fine until a song starts and the visualizer starts to draw. It seems like it wipes out the Quartz 2D above it. Even having it call setNeedsDisplay on the view above it every time it draws is not working. Like OpenGL is given exclusive access to draw there. The UIImageView eq points however, stay visible.
Is there any way to use Quartz 2D on top of a view with a gl layer? I'd prefer not to use OpenGL to draw the path and tick marks using OpenGL because I would have to draw to either a 512x512 or 1024x1024 texture and scale it, so it would not look perfect, and I've already got the working Quartz code to draw everything.
Is there any way to use Quartz 2D on top of a view with a gl layer?
Yes, this is explicitly supported. The docs even give details on how to optimize drawing for this configuration.
My suspicion is that your views are actually in the wrong order and the GL view is on top. First, make sure your GL view is marked opaque
(for performance, but also because it will make it more obvious if it's in the wrong order). Then check your view ordering (check the main view's subviews
).