Beispiel #1
0
        /// <summary>
        /// Clear surface buffers.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for clearing buffers.
        /// </param>
        /// <param name="bufferMask">
        /// A <see cref="GraphicsBuffersFormat.BufferType"/> indicating which buffers to clear.
        /// </param>
        public void Clear(GraphicsContext ctx, GraphicsBuffersFormat.BufferType bufferMask)
        {
            // Update clear values (only what is necessary)
            if ((bufferMask & GraphicsBuffersFormat.BufferType.Color) != 0)
            {
                Gl.ClearColor(mClearColor.Red, mClearColor.Green, mClearColor.Blue, mClearColor.Alpha);
            }
            if ((bufferMask & GraphicsBuffersFormat.BufferType.Depth) != 0)
            {
                Gl.ClearDepth(mClearDepth);
            }
            if ((bufferMask & GraphicsBuffersFormat.BufferType.Stencil) != 0)
            {
                Gl.ClearStencil(mClearStencil);
            }

            // Clear
            Gl.Clear(GetClearFlags(bufferMask));
        }