黑屏/没有事件在iOS OpenGL ES 2 [英] black screen / no events in iOS OpenGL ES 2

查看:1058
本文介绍了黑屏/没有事件在iOS OpenGL ES 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理大约45天的错误。我已经尝试过数十种方法调用,更改整个程序,但没有任何工作。



我使用GLES 2,具有作为rootViewController的UIViewController,具有键入UIView,其层类为CAEAGLLayer。



当我运行应用程序时,屏幕变黑,如果我按屏幕,则不会生成事件。



如果我旋转应用程序,屏幕将出现,并且事件工作。最糟糕的是,如果我不旋转应用程序,而是在presentRenderbuffer之后放置一个断点,然后按下Xcode中的Capture OpenGL ES Frame按钮,屏幕将出现,事件开始工作



我觉得视图没有被显示,但是,我实现了viewWillLayoutSubviews,viewWillAppear,viewDidAppear,loadView(我在哪里开始一切),所有这些方法都得到按以下顺序调用:



加载视图
视图将出现
视图将布局子视图
视图出现



此外,该视图实际上是一个有效的框架大小。



对于这个绝望的用户,任何帮助都非常感谢。 b
$ b

解决方案

此问题的解决方案是:在主线程中设置上下文创建所有窗口,然后通过调用

 共享所有线程之间的open gl上下文[EAGLContext setC urrentContext:glcontext] 

每个线程


I'm dealing with an error for about 45 days. I already tried dozens of method calls, change the whole program, but nothing works.

I use GLES 2, with a UIViewController that is the rootViewController, that has a view of type UIView, whose layerclass is CAEAGLLayer.

When i run the application, the screen gets black and if i press the screen, no events are generated.

If i rotate the application, the screen appears and the events work. Even worst, if i dont rotate the application, but put a breakpoint right after the presentRenderbuffer, and press the "Capture OpenGL ES Frame" button inside Xcode, the screen appears and the events start working!!!

What i feel is that the view is not actually shown, however, i implemented the viewWillLayoutSubviews, viewWillAppear, viewDidAppear, loadView (where i start everything), all these methods gets called in this order:

load view view will appear view will layout subviews view did appear

Also, the view has actually a valid frame size.

Any help is greatly appreciated for this desperate user.

guich

解决方案

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

[EAGLContext setCurrentContext:glcontext]

at each thread

这篇关于黑屏/没有事件在iOS OpenGL ES 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆