CSPspEmu.Gui.CommonGuiDisplayOpengl.GetTexOpengl C# (CSharp) Method

GetTexOpengl() private method

private GetTexOpengl ( Action Action ) : void
Action Action
return void
        private void GetTexOpengl(Action<TexturePair> Action)
        {
            //Console.WriteLine("OpenglGpuImpl.FrameBufferTexture: {0}, {1}, {2}", OpenglGpuImpl.FrameBufferTexture, GL.IsTexture(OpenglGpuImpl.FrameBufferTexture), GL.IsTexture(2));
            var OpenglGpuImpl = (GpuProcessor.GpuImpl as OpenglGpuImpl);
            if (OpenglGpuImpl == null)
            {
                Action(new TexturePair() { Color = GLTexture.Wrap(0), Depth = GLTexture.Wrap(0) });
                return;
            }

            OpenglGpuImpl.RenderbufferManager.GetDrawBufferTextureAndLock(new DrawBufferKey()
            {
                Address = PspDisplay.CurrentInfo.FrameAddress,
                //Width = PspDisplayForm.Singleton.PspDisplay.CurrentInfo.Width,
                //Height = PspDisplayForm.Singleton.PspDisplay.CurrentInfo.Height
            }, (DrawBuffer) =>
            {

                if (DrawBuffer == null)
                {
                    Action(null);
                    return;
                }
                else
                {
                    var RenderTarget = DrawBuffer.RenderTarget;
                    if (GL.glIsTexture(RenderTarget.TextureColor.Texture))
                    {
                        TextureVerticalFlip = false;
                        Action(new TexturePair() { Color = RenderTarget.TextureColor, Depth = RenderTarget.TextureDepth });
                        return;
                    }
                    else
                    {
                        Console.WriteLine("Not shared contexts");
                    }
                }
            });
        }