public sealed override void Draw(Action <TexturedVertex2D> vertexAction)
        {
            if (RequiresRedraw)
            {
                SharedData.ResetCurrentEffectBuffer();

                using (establishFrameBufferViewport())
                {
                    // Fill the frame buffer with drawn children
                    using (BindFrameBuffer(SharedData.MainBuffer))
                    {
                        // We need to draw children as if they were zero-based to the top-left of the texture.
                        // We can do this by adding a translation component to our (orthogonal) projection matrix.
                        GLWrapper.PushOrtho(screenSpaceDrawRectangle);
                        GLWrapper.Clear(new ClearInfo(backgroundColour));

                        Child.Draw(vertexAction);

                        GLWrapper.PopOrtho();
                    }

                    PopulateContents();
                }

                SharedData.DrawVersion = GetDrawVersion();
            }

            Shader.Bind();

            base.Draw(vertexAction);
            DrawContents();

            Shader.Unbind();
        }
        protected override void PreDraw()
        {
            frameBuffer.Bind();

            // Set viewport to the texture size
            GLWrapper.PushViewport(new Rectangle(0, 0, frameBuffer.Texture.Width, frameBuffer.Texture.Height));
            // We need to draw children as if they were zero-based to the top-left of the texture
            // so we make the new zero be this container's position without affecting children in any negative ways
            GLWrapper.PushOrtho(new Rectangle((int)ScreenSpaceDrawQuad.TopLeft.X, (int)ScreenSpaceDrawQuad.TopLeft.Y, frameBuffer.Texture.Width, frameBuffer.Texture.Height));

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);
        }
        private void drawChildren(IVertexBatch vertexBatch, Vector2 frameBufferSize)
        {
            // Fill the frame buffer with drawn children
            using (bindFrameBuffer(currentFrameBuffer, frameBufferSize))
            {
                // We need to draw children as if they were zero-based to the top-left of the texture.
                // We can do this by adding a translation component to our (orthogonal) projection matrix.
                GLWrapper.PushOrtho(ScreenSpaceDrawRectangle);

                GLWrapper.ClearColour(BackgroundColour);
                base.Draw(vertexBatch);

                GLWrapper.PopOrtho();
            }
        }