// コンテクストのリソースを取得する
- (void)initOpenGL {
if ([EAGLContext currentContext]==nil) {
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
}
else{
context = [[EAGLContext alloc] initWithAPI:[[EAGLContext currentContext] API] sharegroup: [[EAGLContext currentContext] sharegroup]];
}
if (!context || ![EAGLContext setCurrentContext:context]) {
return;
}
// ... (略)
}
Reference:
https://developer.apple.com/library/ios/qa/qa1612/_index.html
https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/WorkingwithOpenGLESContexts/WorkingwithOpenGLESContexts.html
https://developer.apple.com/jp/documentation/OpenGLES_ProgrammingGuide.pdf