iphone - How to replace OpenGL ES 1.1 EAGLLayer view with OpenGL view from GLKit? -
i have simple game uses eagllayer directly. had set runloop , opengl es boilerplate. game crashes because of opengl backgrounding problems. heard glkit has robust boilerplate opengl view takes care of opengl initialize , suspension.
is possible set glkit view opengl 1.1 , start?
this rather open-ended question, it's best start getting background glkit , ask more questions if have specific issues.
take @ code when creating new xcode project using "opengl game" template -- sets glkview
, glkviewcontroller
you. there's description of how these classes work , how use them in apple's opengl es programming guide.
the overall gist of it: glkview
of framebuffer, renderbuffer, , viewport setup , presentation basic opengl es drawing (including framebuffer juggling multisampling if want that) have issue drawing commands. glkviewcontroller
owns glkview
, runs animation timer calls drawing code -- default, makes sure not call drawing code when app in background.
if you're using glkviewcontroller
, making opengl es calls glkview
(subclass or delegate) drawing method, shouldn't have worry crashing due gpu use in background. if seeing such crashes (with gpus_returnnotpermittedkillclient
in stack trace), can try forcing gl complete processing before going background -- call glfinish()
in applicationwillresignactive:
.
Comments
Post a Comment