How can I combine my UIView and my EAGLView?

I have an opengl scene rendering at the EAGLView level and some other rendering elements (circles and such) on a UIView (which is a child of the EAGLView located above it). Is it possible to mix colors between two layers? I would like to make some kind of different blending in order to get the inverse effect on the colors from EAGLView.

I played with CGBlendMode, but that only affects what I'm painting in this current view. I think this has something to do with CGContext, but I'm a bit unclear in the details, can I get UIView and EAGLView to have the same CGContext so that the mix works between them?

Help, corrections, clarifications are welcome. Thanks in advance, -S

+3
source share
2 answers

Short answer: you cannot. The following is a long answer.

By EAGLViewyou should understand the subclass UIViewthat is included in the OpenGL ES template in Xcode. The peculiarity of this class is that the class method is layerClassoverridden and returns a class CAEAGLLayerinstead of a class CALayer, as by default.

UIViewand CALayerwork in pairs. All objects UIVieware supported CALayer, CALayer- the object responsible for the layout and rendering on the screen. UIViewis a delegate CALayerand is responsible for drawing his graphics if necessary.

CALayer (UIView) draw CGContextRef. UIView, CGBlendMode , UIView.

CALayer . iPhone, undefined . , Core Image iPhone OS.

+7

, . , , ( ), XOR.

0

Source: https://habr.com/ru/post/1717289/


All Articles