Type Reason ArgumentException iPhoneOSGameView.ContextRenderingApi hasn't been initialized. InvalidOperationException iPhoneOSGameView.LayerColorFormat hasn't been initialized. ObjectDisposedException The instance has had Foundation.NSObject.Dispose invoked on it.
This method is invoked to create an OpenTK.Graphics.IGraphicsContext implementation, create a OpenGLES.EAGLContext, and initialize the GL context so that a framebuffer and renderbuffer exist for future GL calls.
This method is invoked by: iPhoneOSGameView.LayoutSubviews, iPhoneOSGameView.Run, and iPhoneOSGameView.Run(double).
Inheritors can override either iPhoneOSGameView.ConfigureLayer(CoreAnimation.CAEAGLLayer), or this method to add additional construction logic (e.g. to add a depth buffer). If only the layer needs to be configured, then override ConfigureLayer; otherwise, override this method and call this implementation to create the framebuffer and renderbuffer.
Intelligent OpenGLES fallback can be performed by changing the iPhoneOSGameView.ContextRenderingApi if an error occurs. For example:
C# Example
protected override CreateFrameBuffer()
{
try {
ContextRenderingApi = EAGLRenderingAPI.OpenGLES2;
base.CreateFrameBuffer();
} catch (Exception) {
// device doesn't support OpenGLES 2.0; retry with 1.1:
ContextRenderingApi = EAGLRenderingAPI.OpenGLES1;
base.CreateFrameBuffer();
}
}