11#include " Filters.hpp"
22
3+ #include < Renderer/BlendMode.hpp>
4+
5+ using libprojectM::Renderer::BlendMode;
6+
37namespace libprojectM {
48namespace MilkdropPreset {
59
@@ -20,7 +24,7 @@ void Filters::Draw()
2024 return ;
2125 }
2226
23- glEnable (GL_BLEND );
27+ BlendMode::SetBlendActive ( true );
2428
2529 auto shader = m_presetState.untexturedShader .lock ();
2630 shader->Bind ();
@@ -48,37 +52,37 @@ void Filters::Draw()
4852 Renderer::Mesh::Unbind ();
4953 Renderer::Shader::Unbind ();
5054
51- glDisable (GL_BLEND );
55+ BlendMode::SetBlendActive ( false );
5256}
5357
5458
5559void Filters::Brighten ()
5660{
57- glBlendFunc (GL_ONE_MINUS_DST_COLOR, GL_ZERO );
61+ BlendMode::SetBlendFunction (BlendMode::Function::OneMinusDestinationColor, BlendMode::Function::Zero );
5862 m_filterMesh.Draw ();
59- glBlendFunc (GL_ZERO, GL_DST_COLOR );
63+ BlendMode::SetBlendFunction (BlendMode::Function::Zero, BlendMode::Function::DestinationColor );
6064 m_filterMesh.Draw ();
61- glBlendFunc (GL_ONE_MINUS_DST_COLOR, GL_ZERO );
65+ BlendMode::SetBlendFunction (BlendMode::Function::OneMinusDestinationColor, BlendMode::Function::Zero );
6266 m_filterMesh.Draw ();
6367}
6468
6569void Filters::Darken ()
6670{
67- glBlendFunc (GL_ZERO, GL_DST_COLOR );
71+ BlendMode::SetBlendFunction (BlendMode::Function::Zero, BlendMode::Function::DestinationColor );
6872 m_filterMesh.Draw ();
6973}
7074
7175void Filters::Solarize ()
7276{
73- glBlendFunc (GL_ZERO, GL_ONE_MINUS_DST_COLOR );
77+ BlendMode::SetBlendFunction (BlendMode::Function::Zero, BlendMode::Function::OneMinusDestinationColor );
7478 m_filterMesh.Draw ();
75- glBlendFunc (GL_DST_COLOR, GL_ONE );
79+ BlendMode::SetBlendFunction (BlendMode::Function::DestinationColor, BlendMode::Function::One );
7680 m_filterMesh.Draw ();
7781}
7882
7983void Filters::Invert ()
8084{
81- glBlendFunc (GL_ONE_MINUS_DST_COLOR, GL_ZERO );
85+ BlendMode::SetBlendFunction (BlendMode::Function::OneMinusDestinationColor, BlendMode::Function::Zero );
8286 m_filterMesh.Draw ();
8387}
8488
0 commit comments