3

I have a simple game which uses EAGLLayer directly. I had to set up the runloop and all OpenGL ES boilerplate. Game sometimes crashes because of OpenGL backgrounding problems. I heard the GLKit has a robust boilerplate OpenGL view which takes care of OpenGL initialize and suspension.

Is it possible to set up this GLKit view for OpenGL 1.1 and where would I start?

openfrog
  • 40,201
  • 65
  • 225
  • 373
  • have you managed to run OpenGLES 1.1 on GLKit ? If yes can you please post the solution here ? – Dorald Jan 01 '17 at 20:07

1 Answers1

1

This is a rather open-ended question, so it's probably best to start by getting yourself some background with GLKit and then ask more questions if you have specific issues.

Take a look at the code you get when creating a new Xcode project using the "OpenGL Game" template -- this sets up a GLKView and GLKViewController for you. There's also some description of how these classes work and how to use them in Apple's OpenGL ES Programming Guide.

The overall gist of it: GLKView does all of the framebuffer, renderbuffer, and viewport setup and presentation for basic OpenGL ES drawing (including all the extra framebuffer juggling for multisampling if you want that) so that all you have to do is issue drawing commands. GLKViewController owns a GLKView and runs an animation timer that calls your drawing code -- by default, it makes sure not to call your drawing code when the app is in the background.

If you're using GLKViewController and only making OpenGL ES calls from the GLKView (subclass or delegate) drawing method, you shouldn't have to worry about crashing due to GPU use in the background. If you are seeing such crashes (with gpus_ReturnNotPermittedKillClient in the stack trace), it can help to try forcing the GL to complete processing before going to the background -- call glFinish() in applicationWillResignActive:.

rickster
  • 124,678
  • 26
  • 272
  • 326