i created below view class
public partial class MyGLUIView : iPhoneOSGameView
{
int intHeight = (int)UIScreen.MainScreen.Bounds.Height;
int intWidth = (int)UIScreen.MainScreen.Bounds.Width;
myRendererHandler rendrer = RendererHandler.SharedInstance();
[Export("layerClass")]
static Class LayerClass()
{
return iPhoneOSGameView.GetLayerClass();
}
[Export("initWithCoder:")]
public MyGLUIView(NSCoder coder) : base(coder)
{
LayerRetainsBacking = false;
LayerColorFormat = EAGLColorFormat.RGBA8;
ContextRenderingApi = EAGLRenderingAPI.OpenGLES1;
}
public void SetData(int NUMBER_DEVICES, TopologyBinaryData[] data)
{
//set data to renderer
}
protected override void ConfigureLayer(CAEAGLLayer eaglLayer)
{
eaglLayer.Opaque = true;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
MakeCurrent();
rendrer.InitializeTextures();
}
public void onTapEvent(int x, int y)
{
rendrer.ProcessExpansion(x, y);
}
protected override void OnRenderFrame(FrameEventArgs e)
{
base.OnRenderFrame(e);
rendrer.render();
SwapBuffers();
}
protected override void CreateFrameBuffer()
{
}
}
and the viewcontroller class is
public partial class TopologyViewController : UIViewController
{
public TopologyViewController(IntPtr handle) : base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
WireUpTapGestureRecognizer();
}
protected void WireUpTapGestureRecognizer()
{
// create a new tap gesture
UITapGestureRecognizer tapGesture = null;
Action action = () =>
{
};
tapGesture = new UITapGestureRecognizer(action);
// configure it
tapGesture.NumberOfTapsRequired = 1;
// add the gesture recognizer to the view
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
}
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
}
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
this.topologyView.Stop();
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
if i load above view first time its working fine but after going back and load this view again nothing is drawing and the EAGLContext is null. Application crashesh when i press back(Navigation button) again at
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
**this.topologyView.Stop();**
}
i am using xamarin studio and openTK 1.0.
The OS will free EGL contexts to reduce memory for back-grounded views and processes; hence the EAGL context is null. If you want to resume drawing you'll have to recreate the EAGL context and the graphics resources.