Black screen / no events in iOS OpenGL ES 2

I am dealing with an error of about 45 days. I have already tried dozens of method calls, changing the entire program, but nothing works.

I am using GLES 2 with a UIViewController, which is the rootViewController, which is of type UIView, whose layerclass is CAEAGLLayer.

When I launch the application, the screen turns black, and if I click on the screen, events are not generated.

If I rotate the application, a screen appears and events work. Even worse, if I donโ€™t rotate the application, but set a breakpoint immediately after the current Renderbuffer and clicked the โ€œCapture OpenGL ES Frameโ€ button inside Xcode, a screen will appear and events will start working !!!

I believe that the view is not actually shown, however I implemented viewWillLayoutSubviews, viewWillAppear, viewDidAppear, loadView (where I start everything), all these methods are called in the following order:

view will appear view view will display layouts view appeared

In addition, the view has a valid frame size.

Any help is greatly appreciated for this desperate user.

guich

+4
source share
1 answer

The solution to this problem was: set up the context in the main thread where all the windows were created, and then share the open gl context between all the threads, calling

[EAGLContext setCurrentContext:glcontext] 

in each thread

+2
source

All Articles