bind zero when texture is not defined for dual brush or pattern to avoid using the previous tex in slot

This commit is contained in:
2019-02-26 16:23:51 +01:00
parent 451406c17c
commit cedb8bc3fe
4 changed files with 27 additions and 18 deletions

View File

@@ -106,8 +106,9 @@ void NodeStrokePreview::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2
glActiveTexture(GL_TEXTURE3);
m_tex_dual.bind();
glActiveTexture(GL_TEXTURE4);
if (b->m_pattern_texture)
b->m_pattern_texture->bind();
b->m_pattern_texture ?
b->m_pattern_texture->bind() :
glBindTexture(GL_TEXTURE_2D, 0);
m_plane.draw_fill();
m_rtt_mixer.unbindFramebuffer();
@@ -327,8 +328,9 @@ void NodeStrokePreview::draw_stroke()
ShaderManager::u_float(kShaderUniform::Wet, 0);
ShaderManager::u_float(kShaderUniform::Noise, 0);
glActiveTexture(GL_TEXTURE0);
if (dual_brush->m_tip_texture)
dual_brush->m_tip_texture->bind();
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
glBindTexture(GL_TEXTURE_2D, 0);
auto frames_dual = stroke_draw_compute(m_dual_stroke);
for (auto& f : frames_dual)
{
@@ -357,8 +359,9 @@ void NodeStrokePreview::draw_stroke()
glActiveTexture(GL_TEXTURE1);
m_tex.bind(); // tmp swap for blending
glActiveTexture(GL_TEXTURE2);
if (b->m_pattern_texture)
b->m_pattern_texture->bind();
b->m_pattern_texture ?
b->m_pattern_texture->bind() :
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE3);
m_rtt_mixer.bindTexture();
auto frames = stroke_draw_compute(m_stroke);
@@ -435,8 +438,9 @@ void NodeStrokePreview::draw_stroke()
glActiveTexture(GL_TEXTURE3);
m_tex_dual.bind();
glActiveTexture(GL_TEXTURE4);
if (b->m_pattern_texture)
b->m_pattern_texture->bind();
b->m_pattern_texture ?
b->m_pattern_texture->bind() :
glBindTexture(GL_TEXTURE_2D, 0);
m_plane.draw_fill();
m_rtt.unbindFramebuffer();