diff --git a/src/app_vr.cpp b/src/app_vr.cpp index 0b4a308..ad81a54 100644 --- a/src/app_vr.cpp +++ b/src/app_vr.cpp @@ -121,8 +121,9 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat glActiveTexture(GL_TEXTURE2); canvas->m_canvas->m_smask.m_rtt[plane_index].bindTexture(); glActiveTexture(GL_TEXTURE3); - 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_face_plane.draw_fill(); glActiveTexture(GL_TEXTURE2); canvas->m_canvas->m_smask.m_rtt[plane_index].unbindTexture(); diff --git a/src/canvas.cpp b/src/canvas.cpp index f559972..39517c9 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -515,8 +515,9 @@ void Canvas::stroke_draw() glActiveTexture(GL_TEXTURE0); brush->m_tip_texture->bind(); glActiveTexture(GL_TEXTURE2); - if (brush->m_pattern_texture) - brush->m_pattern_texture->bind(); + brush->m_pattern_texture ? + brush->m_pattern_texture->bind() : + glBindTexture(GL_TEXTURE_2D, 0); glActiveTexture(GL_TEXTURE3); m_mixer.bindTexture(); auto frames = stroke_draw_compute(*m_current_stroke); @@ -558,8 +559,9 @@ void Canvas::stroke_draw() 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) { @@ -828,8 +830,9 @@ void Canvas::stroke_commit() if (b->m_dual_enabled) m_tmp_dual[i].bindTexture(); 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(); glActiveTexture(GL_TEXTURE3); if (b->m_dual_enabled) diff --git a/src/node_canvas.cpp b/src/node_canvas.cpp index b7c1167..2b06fa8 100644 --- a/src/node_canvas.cpp +++ b/src/node_canvas.cpp @@ -242,8 +242,9 @@ void NodeCanvas::draw() if (b->m_dual_enabled) m_canvas->m_tmp_dual[plane_index].bindTexture(); 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_face_plane.draw_fill(); glActiveTexture(GL_TEXTURE3); if (b->m_dual_enabled) diff --git a/src/node_stroke_preview.cpp b/src/node_stroke_preview.cpp index 2e20a71..106005a 100644 --- a/src/node_stroke_preview.cpp +++ b/src/node_stroke_preview.cpp @@ -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();