/// <summary> /// Sets the blending function to draw with. /// </summary> /// <param name="blendingInfo">The infor we should use to update the active state.</param> public static void SetBlend(BlendingInfo blendingInfo) { if (lastBlendingInfo.Equals(blendingInfo)) { return; } FlushCurrentBatch(); if (blendingInfo.IsDisabled) { if (!lastBlendingEnabledState.HasValue || lastBlendingEnabledState.Value) { GL.Disable(EnableCap.Blend); } lastBlendingEnabledState = false; } else { if (!lastBlendingEnabledState.HasValue || !lastBlendingEnabledState.Value) { GL.Enable(EnableCap.Blend); } lastBlendingEnabledState = true; GL.BlendEquationSeparate(blendingInfo.RGBEquation, blendingInfo.AlphaEquation); GL.BlendFuncSeparate(blendingInfo.Source, blendingInfo.Destination, blendingInfo.SourceAlpha, blendingInfo.DestinationAlpha); } lastBlendingInfo = blendingInfo; }