fix stroke preview

This commit is contained in:
2019-11-17 14:52:42 +01:00
parent aa317dcc22
commit ff73e98a2e
2 changed files with 11 additions and 6 deletions

View File

@@ -1259,7 +1259,9 @@ void Canvas::stroke_start(glm::vec3 point, float pressure)
m_tmp_dual[i].unbindFramebuffer();
}
}
m_mixer.bindFramebuffer();
m_mixer.clear();
m_mixer.unbindFramebuffer();
m_show_tmp = true;
}
void Canvas::layer_add(std::string name, std::shared_ptr<Layer> layer /*= nullptr*/, int index /*= 0*/)

View File

@@ -129,7 +129,7 @@ void NodeStrokePreview::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2
glActiveTexture(GL_TEXTURE0);
m_tex_background.bind();
glActiveTexture(GL_TEXTURE1);
m_tex.bind();
m_rtt.bindTexture();
glActiveTexture(GL_TEXTURE3);
m_tex_dual.bind();
glActiveTexture(GL_TEXTURE4);
@@ -144,7 +144,7 @@ void NodeStrokePreview::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2
glm::vec4 NodeStrokePreview::stroke_draw_samples(std::array<vertex_t, 4>& P, Texture2D& blend_tex)
{
//if (!ShaderManager::ext_framebuffer_fetch)
if (!ShaderManager::ext_framebuffer_fetch)
{
glActiveTexture(GL_TEXTURE1);
blend_tex.bind(); // bg, copy of framebuffer (copied before drawing)
@@ -164,7 +164,7 @@ glm::vec4 NodeStrokePreview::stroke_draw_samples(std::array<vertex_t, 4>& P, Tex
glm::vec2 pad(1);
glm::ivec2 tex_pos = glm::clamp(glm::floor(bb_min) - pad, { 0, 0 }, size);
glm::ivec2 tex_sz = glm::clamp(glm::ceil(bb_sz) + pad * 2.f, { 0, 0 }, (glm::vec2)(glm::ivec2(size) - tex_pos));
//if (!ShaderManager::ext_framebuffer_fetch)
if (!ShaderManager::ext_framebuffer_fetch)
{
// this is also used by the mixer
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, tex_pos.x, tex_pos.y,
@@ -184,7 +184,7 @@ glm::vec4 NodeStrokePreview::stroke_draw_samples(std::array<vertex_t, 4>& P, Tex
}
m_brush_shape.draw_fill();
//if (!ShaderManager::ext_framebuffer_fetch)
if (!ShaderManager::ext_framebuffer_fetch)
{
glActiveTexture(GL_TEXTURE1);
blend_tex.unbind();
@@ -414,8 +414,11 @@ void NodeStrokePreview::draw_stroke_immediate()
glActiveTexture(GL_TEXTURE0);
b->m_tip_texture->bind();
if (!ShaderManager::ext_framebuffer_fetch)
{
glActiveTexture(GL_TEXTURE1);
m_tex.bind(); // tmp swap for blending
}
glActiveTexture(GL_TEXTURE2);
b->m_pattern_texture ?
b->m_pattern_texture->bind() :