Aiv.Fast2D.Android.MobileGame.CreateFrameBuffer C# (CSharp) Method

CreateFrameBuffer() protected method

protected CreateFrameBuffer ( ) : void
return void
        protected override void CreateFrameBuffer()
        {
            ContextRenderingApi = GLVersion.ES3;

            // the default GraphicsMode that is set consists of (16, 16, 0, 0, 2, false)
            try
            {
                Log.Verbose("Aiv.Fast2D", "Trying OpenGL ES3");

                // if you don't call this, the context won't be created
                base.CreateFrameBuffer();
                return;
            }
            catch (Exception ex)
            {
                Log.Verbose("Aiv.Fast2D", "{0}", ex);
            }

            // this is a graphics setting that sets everything to the lowest mode possible so
            // the device returns a reliable graphics setting.
            try
            {
                ContextRenderingApi = GLVersion.ES2;
                Window.SetObsoleteMode();

                // a framebuffer could be already created in previous attempt
                try {
                    base.DestroyFrameBuffer();
                }
                catch { }

                Log.Verbose("Aiv.Fast2D", "Trying OpenGL ES2");

                // if you don't call this, the context won't be created
                base.CreateFrameBuffer();
                return;
            }
            catch (Exception ex)
            {
                Log.Verbose("Aiv.Fast2D", "{0}", ex);
            }
            throw new Exception("Can't setup OpenGL ES, aborting");
        }