private void SetAllBlendState(BlendState New) { Enable(EnableCap.Blend, New.Enabled); if (New.Enabled) { if (New.SeparateAlpha) { GL.BlendEquationSeparate( OglEnumConverter.GetBlendEquation(New.EquationRgb), OglEnumConverter.GetBlendEquation(New.EquationAlpha)); GL.BlendFuncSeparate( (BlendingFactorSrc)OglEnumConverter.GetBlendFactor(New.FuncSrcRgb), (BlendingFactorDest)OglEnumConverter.GetBlendFactor(New.FuncDstRgb), (BlendingFactorSrc)OglEnumConverter.GetBlendFactor(New.FuncSrcAlpha), (BlendingFactorDest)OglEnumConverter.GetBlendFactor(New.FuncDstAlpha)); } else { GL.BlendEquation(OglEnumConverter.GetBlendEquation(New.EquationRgb)); GL.BlendFunc( OglEnumConverter.GetBlendFactor(New.FuncSrcRgb), OglEnumConverter.GetBlendFactor(New.FuncDstRgb)); } } }
private void SetBlendState(int index, BlendState New, BlendState old) { if (New.Enabled != old.Enabled) { Enable(IndexedEnableCap.Blend, index, New.Enabled); } if (New.Enabled) { if (New.SeparateAlpha) { if (New.EquationRgb != old.EquationRgb || New.EquationAlpha != old.EquationAlpha) { GL.BlendEquationSeparate( index, OglEnumConverter.GetBlendEquation(New.EquationRgb), OglEnumConverter.GetBlendEquation(New.EquationAlpha)); } if (New.FuncSrcRgb != old.FuncSrcRgb || New.FuncDstRgb != old.FuncDstRgb || New.FuncSrcAlpha != old.FuncSrcAlpha || New.FuncDstAlpha != old.FuncDstAlpha) { GL.BlendFuncSeparate( index, (BlendingFactorSrc)OglEnumConverter.GetBlendFactor(New.FuncSrcRgb), (BlendingFactorDest)OglEnumConverter.GetBlendFactor(New.FuncDstRgb), (BlendingFactorSrc)OglEnumConverter.GetBlendFactor(New.FuncSrcAlpha), (BlendingFactorDest)OglEnumConverter.GetBlendFactor(New.FuncDstAlpha)); } } else { if (New.EquationRgb != old.EquationRgb) { GL.BlendEquation(index, OglEnumConverter.GetBlendEquation(New.EquationRgb)); } if (New.FuncSrcRgb != old.FuncSrcRgb || New.FuncDstRgb != old.FuncDstRgb) { GL.BlendFunc( index, (BlendingFactorSrc)OglEnumConverter.GetBlendFactor(New.FuncSrcRgb), (BlendingFactorDest)OglEnumConverter.GetBlendFactor(New.FuncDstRgb)); } } } }