internal void ApplyState(GraphicsDevice device) { GL.Enable(EnableCap.Blend); GL.ColorMask((this.ColorWriteChannels & ColorWriteChannels.Red) == ColorWriteChannels.Red, (this.ColorWriteChannels & ColorWriteChannels.Green) == ColorWriteChannels.Green, (this.ColorWriteChannels & ColorWriteChannels.Blue) == ColorWriteChannels.Blue, (this.ColorWriteChannels & ColorWriteChannels.Alpha) == ColorWriteChannels.Alpha); GL.BlendEquation(GraphicsExtensions.GetBlendEquationMode(this.ColorBlendFunction)); GL.BlendFunc(GraphicsExtensions.GetBlendFactorSrc(this.ColorSourceBlend), GraphicsExtensions.GetBlendFactorDest(this.ColorDestinationBlend)); }
internal void ApplyState(GraphicsDevice device) { if (this.ColorSourceBlend != Blend.One || this.ColorDestinationBlend != Blend.Zero || this.AlphaSourceBlend != Blend.One || this.AlphaDestinationBlend != Blend.Zero) { GL.Enable(EnableCap.Blend); } else { GL.Disable(EnableCap.Blend); } GL.BlendColor((float)this.BlendFactor.R / (float)byte.MaxValue, (float)this.BlendFactor.G / (float)byte.MaxValue, (float)this.BlendFactor.B / (float)byte.MaxValue, (float)this.BlendFactor.A / (float)byte.MaxValue); GL.ColorMask((this.ColorWriteChannels & ColorWriteChannels.Red) == ColorWriteChannels.Red, (this.ColorWriteChannels & ColorWriteChannels.Green) == ColorWriteChannels.Green, (this.ColorWriteChannels & ColorWriteChannels.Blue) == ColorWriteChannels.Blue, (this.ColorWriteChannels & ColorWriteChannels.Alpha) == ColorWriteChannels.Alpha); GL.BlendEquation(GraphicsExtensions.GetBlendEquationMode(this.ColorBlendFunction)); GL.BlendEquationSeparate(GraphicsExtensions.GetBlendEquationMode(this.ColorBlendFunction), GraphicsExtensions.GetBlendEquationMode(this.AlphaBlendFunction)); GL.BlendFuncSeparate(GraphicsExtensions.GetBlendFactorSrc(this.ColorSourceBlend), GraphicsExtensions.GetBlendFactorDest(this.ColorDestinationBlend), GraphicsExtensions.GetBlendFactorSrc(this.AlphaSourceBlend), GraphicsExtensions.GetBlendFactorDest(this.AlphaDestinationBlend)); }