Esempio n. 1
0
        protected override void PreDraw()
        {
            base.PreDraw();

            if (maskingRect != null)
            {
                GLWrapper.PushScissor(maskingRect);
            }
        }
        private IDisposable establishFrameBufferViewport()
        {
            // Disable masking for generating the frame buffer since masking will be re-applied
            // when actually drawing later on anyways. This allows more information to be captured
            // in the frame buffer and helps with cached buffers being re-used.
            RectangleI screenSpaceMaskingRect = new RectangleI((int)Math.Floor(screenSpaceDrawRectangle.X), (int)Math.Floor(screenSpaceDrawRectangle.Y), (int)frameBufferSize.X + 1, (int)frameBufferSize.Y + 1);

            GLWrapper.PushMaskingInfo(new MaskingInfo
            {
                ScreenSpaceAABB = screenSpaceMaskingRect,
                MaskingRect     = screenSpaceDrawRectangle,
                ToMaskingSpace  = Matrix3.Identity,
                BlendRange      = 1,
                AlphaExponent   = 1,
            }, true);

            // Match viewport to FrameBuffer such that we don't draw unnecessary pixels.
            GLWrapper.PushViewport(new RectangleI(0, 0, (int)frameBufferSize.X, (int)frameBufferSize.Y));
            GLWrapper.PushScissor(new RectangleI(0, 0, (int)frameBufferSize.X, (int)frameBufferSize.Y));
            GLWrapper.PushScissorOffset(screenSpaceMaskingRect.Location);

            return(new ValueInvokeOnDisposal <BufferedDrawNode>(this, d => d.returnViewport()));
        }
 protected override void PreDraw()
 {
     GLWrapper.PushScissor(ScreenSpaceDrawQuad.BoundingRectangle);
 }