implement the complete stroke shader with custom blending mode
This commit is contained in:
@@ -1878,21 +1878,36 @@ public:
|
||||
glViewport(c.x, c.y, c.z, c.w);
|
||||
|
||||
glm::vec2 sz = { m_canvas->m_width, m_canvas->m_height };
|
||||
auto mvp = glm::ortho(0.f, box.z, box.w, 0.f, -1.f, 1.f) *
|
||||
auto mvp = glm::ortho(0.f, box.z, 0.f, box.w, -1.f, 1.f) *
|
||||
//glm::translate(glm::vec3((m_size - sz) * 0.5f, 0)) * // center
|
||||
glm::translate(glm::vec3(0)) * // corner
|
||||
glm::scale(glm::vec3(sz * zoom, 1)) *
|
||||
glm::translate(glm::vec3(.5f, .5f, 0.f)); // pivot
|
||||
|
||||
m_canvas->m_fb.bindTexture();
|
||||
m_canvas->m_sampler.bind(0);
|
||||
ui::ShaderManager::use(kShader::Texture);
|
||||
ui::ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ui::ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
||||
|
||||
bool blend = glIsEnabled(GL_BLEND);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
m_canvas->m_fb.bindTexture();
|
||||
NodeBorder::m_plane.draw_fill();
|
||||
m_canvas->m_sampler.unbind();
|
||||
m_canvas->m_fb.unbindTexture();
|
||||
|
||||
if (m_canvas->m_show_tmp)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
m_canvas->m_tmp.bindTexture();
|
||||
NodeBorder::m_plane.draw_fill();
|
||||
m_canvas->m_tmp.unbindTexture();
|
||||
}
|
||||
|
||||
blend ? glEnable(GL_BLEND) : glDisable(GL_BLEND);
|
||||
|
||||
m_canvas->m_sampler.unbind();
|
||||
|
||||
|
||||
glViewport(vp[0], vp[1], vp[2], vp[3]);
|
||||
glClearColor(cc[0], cc[1], cc[2], cc[3]);
|
||||
|
||||
Reference in New Issue
Block a user