我有一个使用核心数据的应用程序。这是我第一次使用它,所以我使用的是苹果在AppDelegate.m中提供的相同的核心数据栈。
下面描述了我面临的问题:我有一个名为firstSaver的方法,它以如下方式执行操作:
+(void) firstSaver {
// 1) get some values from system
// 2) do some processing on those values ( This takes considerable time)
// 3) create a NSManagedObject instance of entity A
我试着为我的Android游戏项目编写加载屏幕-预加载所有纹理。如果在其他线程中创建纹理,我会得到像纹理宽度设置正确的值,但是只得到黑色的精灵,而不是纹理的,即使glGetError返回0。在同一线程中,一切正常工作,因此假设在sprite或纹理代码中没有错误。
我认为这是因为我试图从另一个线程调用opengl es 2.0函数,而没有EGL提供的上下文。但是,如何从用Java (Android)创建的EGL中获取opengl es 2.0上下文,并将其绑定到本地C中的opengl es 2.0函数中呢?
Java(安卓)
public class OGLES2View extends GLS
我创建了这样一个temporaryContext:
let temporaryContext = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
temporaryContext.parentContext = Utility.managedObjectContext()
temporaryContext.performBlockAndWait({
// .. here I have done some changes on temporaryContext
let success