示例#1
0
        public void ClearBuffers(int RtIndex, GalClearBufferFlags Flags)
        {
            ClearBufferMask Mask = 0;

            //OpenGL doesn't support clearing just a single color channel,
            //so we can't just clear all channels...
            if (Flags.HasFlag(GalClearBufferFlags.ColorRed) &&
                Flags.HasFlag(GalClearBufferFlags.ColorGreen) &&
                Flags.HasFlag(GalClearBufferFlags.ColorBlue) &&
                Flags.HasFlag(GalClearBufferFlags.ColorAlpha))
            {
                Mask = ClearBufferMask.ColorBufferBit;
            }

            if (Flags.HasFlag(GalClearBufferFlags.Depth))
            {
                Mask |= ClearBufferMask.DepthBufferBit;
            }

            if (Flags.HasFlag(GalClearBufferFlags.Stencil))
            {
                Mask |= ClearBufferMask.StencilBufferBit;
            }

            GL.Clear(Mask);
        }
示例#2
0
        public void ClearBuffers(
            GalClearBufferFlags Flags,
            int Attachment,
            float Red, float Green, float Blue, float Alpha,
            float Depth,
            int Stencil)
        {
            GL.ColorMask(
                Flags.HasFlag(GalClearBufferFlags.ColorRed),
                Flags.HasFlag(GalClearBufferFlags.ColorGreen),
                Flags.HasFlag(GalClearBufferFlags.ColorBlue),
                Flags.HasFlag(GalClearBufferFlags.ColorAlpha));

            GL.ClearBuffer(ClearBuffer.Color, Attachment, new float[] { Red, Green, Blue, Alpha });

            if (Flags.HasFlag(GalClearBufferFlags.Depth))
            {
                GL.ClearBuffer(ClearBuffer.Depth, 0, ref Depth);
            }

            if (Flags.HasFlag(GalClearBufferFlags.Stencil))
            {
                GL.ClearBuffer(ClearBuffer.Stencil, 0, ref Stencil);
            }

            GL.ColorMask(true, true, true, true);
        }
示例#3
0
        public void ClearBuffers(
            GalClearBufferFlags Flags,
            float Red, float Green, float Blue, float Alpha,
            float Depth,
            int Stencil)
        {
            ClearBufferMask Mask = ClearBufferMask.ColorBufferBit;

            GL.ColorMask(
                Flags.HasFlag(GalClearBufferFlags.ColorRed),
                Flags.HasFlag(GalClearBufferFlags.ColorGreen),
                Flags.HasFlag(GalClearBufferFlags.ColorBlue),
                Flags.HasFlag(GalClearBufferFlags.ColorAlpha));

            if (Flags.HasFlag(GalClearBufferFlags.Depth))
            {
                Mask |= ClearBufferMask.DepthBufferBit;
            }

            if (Flags.HasFlag(GalClearBufferFlags.Stencil))
            {
                Mask |= ClearBufferMask.StencilBufferBit;
            }

            GL.ClearColor(Red, Green, Blue, Alpha);

            GL.ClearDepth(Depth);

            GL.ClearStencil(Stencil);

            GL.Clear(Mask);

            GL.ColorMask(true, true, true, true);
        }
示例#4
0
        public void ClearBuffers(
            GalClearBufferFlags flags,
            int attachment,
            float red,
            float green,
            float blue,
            float alpha,
            float depth,
            int stencil)
        {
            GL.ColorMask(
                attachment,
                flags.HasFlag(GalClearBufferFlags.ColorRed),
                flags.HasFlag(GalClearBufferFlags.ColorGreen),
                flags.HasFlag(GalClearBufferFlags.ColorBlue),
                flags.HasFlag(GalClearBufferFlags.ColorAlpha));

            GL.ClearBuffer(ClearBuffer.Color, attachment, new float[] { red, green, blue, alpha });

            GL.ColorMask(attachment, true, true, true, true);
            GL.DepthMask(true);

            if (flags.HasFlag(GalClearBufferFlags.Depth))
            {
                GL.ClearBuffer(ClearBuffer.Depth, 0, ref depth);
            }

            if (flags.HasFlag(GalClearBufferFlags.Stencil))
            {
                GL.ClearBuffer(ClearBuffer.Stencil, 0, ref stencil);
            }
        }
示例#5
0
        public void ClearBuffers(
            GalClearBufferFlags Flags,
            int Attachment,
            float Red, float Green, float Blue, float Alpha,
            float Depth,
            int Stencil)
        {
            //OpenGL needs glDepthMask to be enabled to clear it
            if (!DepthWriteEnabled)
            {
                GL.DepthMask(true);
            }

            GL.ColorMask(
                Flags.HasFlag(GalClearBufferFlags.ColorRed),
                Flags.HasFlag(GalClearBufferFlags.ColorGreen),
                Flags.HasFlag(GalClearBufferFlags.ColorBlue),
                Flags.HasFlag(GalClearBufferFlags.ColorAlpha));

            GL.ClearBuffer(ClearBuffer.Color, Attachment, new float[] { Red, Green, Blue, Alpha });

            if (Flags.HasFlag(GalClearBufferFlags.Depth))
            {
                GL.ClearBuffer(ClearBuffer.Depth, 0, ref Depth);
            }

            if (Flags.HasFlag(GalClearBufferFlags.Stencil))
            {
                GL.ClearBuffer(ClearBuffer.Stencil, 0, ref Stencil);
            }

            GL.ColorMask(true, true, true, true);

            if (!DepthWriteEnabled)
            {
                GL.DepthMask(false);
            }
        }
示例#6
0
        public void ClearBuffers(GalClearBufferFlags Flags)
        {
            ClearBufferMask Mask = ClearBufferMask.ColorBufferBit;

            GL.ColorMask(
                Flags.HasFlag(GalClearBufferFlags.ColorRed),
                Flags.HasFlag(GalClearBufferFlags.ColorGreen),
                Flags.HasFlag(GalClearBufferFlags.ColorBlue),
                Flags.HasFlag(GalClearBufferFlags.ColorAlpha));

            if (Flags.HasFlag(GalClearBufferFlags.Depth))
            {
                Mask |= ClearBufferMask.DepthBufferBit;
            }

            if (Flags.HasFlag(GalClearBufferFlags.Stencil))
            {
                Mask |= ClearBufferMask.StencilBufferBit;
            }

            GL.Clear(Mask);

            GL.ColorMask(true, true, true, true);
        }