Move canvas merge GL mappings to renderer gl
This commit is contained in:
@@ -1076,7 +1076,7 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
use_blend |= Canvas::I->m_current_stroke->m_brush->m_blend_mode != 0;
|
||||
|
||||
// if not using shader blend, use gl rasterizer blend
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(depth_test_state());
|
||||
|
||||
for (int plane_index = 0; plane_index < 6; plane_index++)
|
||||
{
|
||||
@@ -1088,7 +1088,7 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
|
||||
if (use_blend)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(blend_state());
|
||||
m_layers_merge.rtt(plane_index).clear();
|
||||
}
|
||||
else
|
||||
@@ -1100,7 +1100,7 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, ortho);
|
||||
m_plane.draw_fill();
|
||||
}
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(blend_state());
|
||||
}
|
||||
|
||||
for (int layer_index = 0; layer_index < m_layers.size(); layer_index++)
|
||||
@@ -1132,17 +1132,17 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
//ShaderManager::u_int(kShaderUniform::Lock, m_layers[layer_index]->m_alpha_locked);
|
||||
ShaderManager::u_int(kShaderUniform::Mask, m_smask_active);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, ortho);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_layers[layer_index]->rtt(plane_index).bindTexture();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
set_active_texture_unit(1);
|
||||
m_tmp[plane_index].bindTexture();
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
set_active_texture_unit(2);
|
||||
m_smask.rtt(plane_index).bindTexture();
|
||||
m_plane.draw_fill();
|
||||
m_smask.rtt(plane_index).unbindTexture();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
set_active_texture_unit(1);
|
||||
m_tmp[plane_index].unbindTexture();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_layers[layer_index]->rtt(plane_index).unbindTexture();
|
||||
}
|
||||
else if (m_current_stroke && m_show_tmp && m_current_layer_idx == layer_index)
|
||||
@@ -1182,28 +1182,28 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
ShaderManager::u_vec2(kShaderUniform::PatternOffset, Canvas::I->m_pattern_offset);
|
||||
ShaderManager::u_float(kShaderUniform::DualAlpha, b->m_dual_opacity);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_layers[layer_index]->rtt(plane_index).bindTexture();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
set_active_texture_unit(1);
|
||||
m_tmp[plane_index].bindTexture();
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
set_active_texture_unit(2);
|
||||
m_smask.rtt(plane_index).bindTexture();
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
set_active_texture_unit(3);
|
||||
if (b->m_dual_enabled)
|
||||
m_tmp_dual[plane_index].bindTexture();
|
||||
glActiveTexture(GL_TEXTURE4);
|
||||
set_active_texture_unit(4);
|
||||
b->m_pattern_texture ?
|
||||
b->m_pattern_texture->bind() :
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
unbind_texture_2d();
|
||||
m_plane.draw_fill();
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
set_active_texture_unit(3);
|
||||
if (b->m_dual_enabled)
|
||||
m_tmp_dual[plane_index].unbindTexture();
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
set_active_texture_unit(2);
|
||||
m_smask.rtt(plane_index).unbindTexture();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
set_active_texture_unit(1);
|
||||
m_tmp[plane_index].unbindTexture();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_layers[layer_index]->rtt(plane_index).unbindTexture();
|
||||
}
|
||||
else
|
||||
@@ -1215,7 +1215,7 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
ShaderManager::u_int(kShaderUniform::Highlight, m_layers[layer_index]->m_hightlight);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, ortho);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_layers[layer_index]->rtt(plane_index).bindTexture();
|
||||
m_plane.draw_fill();
|
||||
m_layers[layer_index]->rtt(plane_index).unbindTexture();
|
||||
@@ -1243,35 +1243,35 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
ShaderManager::u_int(kShaderUniform::TexBG, 2);
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_merge_rtt.bindTexture();
|
||||
if (!ShaderManager::ext_framebuffer_fetch)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
set_active_texture_unit(2);
|
||||
m_merge_tex.bind();
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_width, m_height);
|
||||
glCopyTexSubImage2D(texture_2d_target(), 0, 0, 0, 0, 0, m_width, m_height);
|
||||
}
|
||||
|
||||
m_plane.draw_fill();
|
||||
|
||||
if (!ShaderManager::ext_framebuffer_fetch)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
set_active_texture_unit(2);
|
||||
m_merge_tex.unbind();
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_merge_rtt.unbindTexture();
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
set_active_texture_unit(2);
|
||||
m_merge_tex.bind();
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_width, m_height);
|
||||
glCopyTexSubImage2D(texture_2d_target(), 0, 0, 0, 0, 0, m_width, m_height);
|
||||
|
||||
// draw the grid behind the layers using a temporary copy
|
||||
if (use_blend)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(blend_state());
|
||||
|
||||
//draw the grid
|
||||
if (draw_checkerboard)
|
||||
@@ -1284,7 +1284,7 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
|
||||
// draw the layers
|
||||
m_sampler.bind(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
set_active_texture_unit(0);
|
||||
m_merge_tex.bind();
|
||||
ShaderManager::use(kShader::Texture);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
|
||||
Reference in New Issue
Block a user