I have a MainMenuViewController and a GameViewController which is a GLKViewConrtroller.
The first time I go from the main menu to the GameViewController everything is rendered fine. If I go back to the main menu, the GameViewController and its view get dealloced (I logged it).
When now going back to the game, I see a blank screen, nothing gets rendered OpenGL-wise. The overlay test menu with UIKit is still there.
Thisis how I tear down OpenGL in the GameViewController's dealloc method, the last five lines were added as tries to make it work, so it doesn't work with or without them.
- (void)tearDownGL {
[EAGLContext setCurrentContext:self.context];
glDeleteBuffers(1, &_vertexBuffer);
glDeleteVertexArraysOES(1, &_vertexArray);
self.effect = nil;
_program = nil;
glBindVertexArrayOES(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
[EAGLContext setCurrentContext: nil];
}