///////////////////////////////////////////////////////
| 697 | |
| 698 | //////////////////////////////////////////////////////////// |
| 699 | void RenderTarget::applyBlendMode(const BlendMode& mode) |
| 700 | { |
| 701 | using RenderTargetImpl::equationToGlConstant; |
| 702 | using RenderTargetImpl::factorToGlConstant; |
| 703 | |
| 704 | // Apply the blend mode, falling back to the non-separate versions if necessary |
| 705 | if (GLEXT_blend_func_separate) |
| 706 | { |
| 707 | glCheck(GLEXT_glBlendFuncSeparate(factorToGlConstant(mode.colorSrcFactor), |
| 708 | factorToGlConstant(mode.colorDstFactor), |
| 709 | factorToGlConstant(mode.alphaSrcFactor), |
| 710 | factorToGlConstant(mode.alphaDstFactor))); |
| 711 | } |
| 712 | else |
| 713 | { |
| 714 | glCheck(glBlendFunc(factorToGlConstant(mode.colorSrcFactor), factorToGlConstant(mode.colorDstFactor))); |
| 715 | } |
| 716 | |
| 717 | if (GLEXT_blend_minmax || GLEXT_blend_subtract) |
| 718 | { |
| 719 | if (GLEXT_blend_equation_separate) |
| 720 | { |
| 721 | glCheck(GLEXT_glBlendEquationSeparate(equationToGlConstant(mode.colorEquation), |
| 722 | equationToGlConstant(mode.alphaEquation))); |
| 723 | } |
| 724 | else |
| 725 | { |
| 726 | glCheck(GLEXT_glBlendEquation(equationToGlConstant(mode.colorEquation))); |
| 727 | } |
| 728 | } |
| 729 | else if ((mode.colorEquation != BlendMode::Equation::Add) || (mode.alphaEquation != BlendMode::Equation::Add)) |
| 730 | { |
| 731 | static bool warned = false; |
| 732 | |
| 733 | if (!warned) |
| 734 | { |
| 735 | #ifdef SFML_OPENGL_ES |
| 736 | err() << "OpenGL ES extension OES_blend_subtract unavailable" << std::endl; |
| 737 | #else |
| 738 | err() << "OpenGL extension EXT_blend_minmax and EXT_blend_subtract unavailable" << std::endl; |
| 739 | #endif |
| 740 | err() << "Selecting a blend equation not possible" << '\n' |
| 741 | << "Ensure that hardware acceleration is enabled if available" << std::endl; |
| 742 | |
| 743 | warned = true; |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | m_cache.lastBlendMode = mode; |
| 748 | } |
| 749 | |
| 750 | |
| 751 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected