fix samplers on brush preview
This commit is contained in:
@@ -31,9 +31,10 @@ void NodeStrokePreview::clone_finalize(Node* dest) const
|
||||
void NodeStrokePreview::init_controls()
|
||||
{
|
||||
m_mesh.create();
|
||||
m_sampler.create(GL_LINEAR, GL_REPEAT);
|
||||
m_sampler_brush.create();
|
||||
m_sampler_brush.set_filter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
|
||||
m_sampler_linear.create();
|
||||
m_sampler_linear_repeat.create(GL_LINEAR, GL_REPEAT);
|
||||
m_sampler_mipmap.create();
|
||||
m_sampler_mipmap.set_filter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
|
||||
m_brush_shape.create();
|
||||
// TextureManager::load("data/thumbs/Round-Hard.png");
|
||||
// Canvas::I->m_current_brush.m_tex_id = const_hash("data/thumbs/Round-Hard.png");
|
||||
@@ -91,6 +92,7 @@ void NodeStrokePreview::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2
|
||||
ShaderManager::u_float(kShaderUniform::PatternBright, b->m_pattern_brightness);
|
||||
ShaderManager::u_float(kShaderUniform::PatternContrast, b->m_pattern_contrast);
|
||||
|
||||
m_sampler_linear.bind(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
m_tex_background.bind();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
@@ -228,11 +230,11 @@ void NodeStrokePreview::draw_stroke()
|
||||
glm::mat4 ortho_proj = glm::ortho<float>(0, size.x, 0, size.y, -1, 1);
|
||||
glViewport(0, 0, m_rtt.getWidth(), m_rtt.getHeight());
|
||||
m_rtt.bindFramebuffer();
|
||||
m_sampler.bind(0);
|
||||
m_sampler.bind(1);
|
||||
m_sampler.bind(2);
|
||||
m_sampler.bind(3);
|
||||
m_sampler.bind(4);
|
||||
m_sampler_mipmap.bind(0);
|
||||
m_sampler_linear.bind(1);
|
||||
m_sampler_linear_repeat.bind(2);
|
||||
m_sampler_linear.bind(3);
|
||||
m_sampler_linear.bind(4);
|
||||
|
||||
const auto& b = m_brush;
|
||||
m_stroke.m_filter_points = false;
|
||||
@@ -390,11 +392,11 @@ void NodeStrokePreview::draw_stroke()
|
||||
ShaderManager::u_float(kShaderUniform::PatternBright, b->m_pattern_brightness);
|
||||
ShaderManager::u_float(kShaderUniform::PatternContrast, b->m_pattern_contrast);
|
||||
|
||||
m_sampler.bind(0);
|
||||
m_sampler.bind(1);
|
||||
m_sampler.bind(2);
|
||||
m_sampler.bind(3);
|
||||
m_sampler.bind(4);
|
||||
m_sampler_linear.bind(0);
|
||||
m_sampler_linear.bind(1);
|
||||
m_sampler_linear.bind(2);
|
||||
m_sampler_linear.bind(3);
|
||||
m_sampler_linear_repeat.bind(4);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
m_tex_background.bind();
|
||||
@@ -419,9 +421,9 @@ void NodeStrokePreview::draw()
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
m_rtt.bindTexture();
|
||||
m_sampler.bind(0);
|
||||
m_sampler_linear.bind(0);
|
||||
m_plane.draw_fill();
|
||||
m_sampler.unbind();
|
||||
m_sampler_linear.unbind();
|
||||
m_rtt.unbindTexture();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user