views:

480

answers:

1

I'm trying, unsuccessfully, to combine OpenGL content with other CALayers. In particular, I would like to overlay the OpenGL content above the other layers (with alpha transparency).

I run into two problems:

  1. My OpenGL rendering is never displayed (even though the OpenGL functions succeeds).
  2. The OpenGL rendering is awfully slow (around 1 fps).

I should note that I'm not using a CAEAGLLayer-backed view. Instead, I'm using a custom CAEAGLLayer subclass directly. This may be the problem for #1. Using a layer-backed view may work, but I'm not sure how to proceed to make it transparent.

Regarding #2, I'm aware that the documentation says that there is a performance penalty into mixing EAGLLayers with other layers, and that settings the opaque property to NO is even more costly. But 1 fps seems unreasonably slow.

Any suggestion and/or comments would be appreciated.

EDIT

The GL layer do work when used as a backing-layer of a view. It is not convenient though as I want to use the GL layer in a CALayer hierarchy.

SOLUTION

My mistake, using a CAEAGLLayer works just fine. Silly mistake from my part (I wasn't adding the right layer in the hierarchy).

A: 

Hi I've the same problem. Can you tell me how you create your own CAEAGLLayer, please? Thanks.

raziel
I simply created a subclass of CAEAGLLayer, which I inserted into the layer-tree of some other view. Piece of cake!
Martin Cote
Yeah but my problem is that CAEAGLLayer and CALayer are non synchronized i.e. the CAEAGLLayer is updated immediately after call the presentRenderbuffer method but CALayer is updated on the next loop. How did you solved this problem?
raziel