Convert an sf::BlendMode::Equation constant to the corresponding OpenGL constant.
| 112 | |
| 113 | // Convert an sf::BlendMode::Equation constant to the corresponding OpenGL constant. |
| 114 | std::uint32_t equationToGlConstant(sf::BlendMode::Equation blendEquation) |
| 115 | { |
| 116 | switch (blendEquation) |
| 117 | { |
| 118 | case sf::BlendMode::Equation::Add: |
| 119 | return GLEXT_GL_FUNC_ADD; |
| 120 | case sf::BlendMode::Equation::Subtract: |
| 121 | if (GLEXT_blend_subtract) |
| 122 | return GLEXT_GL_FUNC_SUBTRACT; |
| 123 | break; |
| 124 | case sf::BlendMode::Equation::ReverseSubtract: |
| 125 | if (GLEXT_blend_subtract) |
| 126 | return GLEXT_GL_FUNC_REVERSE_SUBTRACT; |
| 127 | break; |
| 128 | case sf::BlendMode::Equation::Min: |
| 129 | if (GLEXT_blend_minmax) |
| 130 | return GLEXT_GL_MIN; |
| 131 | break; |
| 132 | case sf::BlendMode::Equation::Max: |
| 133 | if (GLEXT_blend_minmax) |
| 134 | return GLEXT_GL_MAX; |
| 135 | break; |
| 136 | } |
| 137 | |
| 138 | static bool warned = false; |
| 139 | if (!warned) |
| 140 | { |
| 141 | sf::err() << "OpenGL extension EXT_blend_minmax or EXT_blend_subtract unavailable" << '\n' |
| 142 | << "Some blending equations will fallback to sf::BlendMode::Equation::Add" << '\n' |
| 143 | << "Ensure that hardware acceleration is enabled if available" << std::endl; |
| 144 | |
| 145 | warned = true; |
| 146 | } |
| 147 | |
| 148 | return GLEXT_GL_FUNC_ADD; |
| 149 | } |
| 150 | |
| 151 | |
| 152 | // Convert an UpdateOperation constant to the corresponding OpenGL constant. |