fix mixer on iOS, work with RGBA16F buffers on iOS instead of fallback to RGBA8
This commit is contained in:
@@ -223,6 +223,7 @@ void ui::Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz
|
||||
{
|
||||
m_mixer.bindFramebuffer();
|
||||
|
||||
float zoom = m_node->root()->m_zoom;
|
||||
glViewport(0, 0, m_mixer.getWidth(), m_mixer.getHeight());
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
@@ -325,6 +326,8 @@ void ui::Canvas::stroke_draw()
|
||||
GLfloat cc[4];
|
||||
glGetIntegerv(GL_VIEWPORT, vp);
|
||||
glGetFloatv(GL_COLOR_CLEAR_VALUE, cc);
|
||||
|
||||
float zoom = m_node->root()->m_zoom;
|
||||
|
||||
auto m_brush = m_current_stroke->m_brush;
|
||||
auto samples = m_current_stroke->compute_samples();
|
||||
@@ -354,9 +357,8 @@ void ui::Canvas::stroke_draw()
|
||||
glm::vec2 bb_max(0, 0);
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
auto p = (m_mixer_sample.pos + off[j] + glm::vec2(0, 1));
|
||||
auto p = (m_mixer_sample.pos + off[j] * glm::orientate2(-s.angle) + glm::vec2(0, 1)) / zoom;
|
||||
UV2[j] = p / sz;
|
||||
//UV2[j].y = 1.f - UV2[j].y;
|
||||
bb_min = glm::max({ 0, 0 }, glm::min(bb_min, p));
|
||||
bb_max = glm::min(sz, glm::max(bb_max, p));
|
||||
}
|
||||
@@ -897,8 +899,8 @@ void ui::Canvas::resize(int width, int height)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
#if __IOS__
|
||||
m_tmp[i].create(width, height, -1, GL_RGBA8);
|
||||
m_tex[i].create(width, height, GL_RGBA8);
|
||||
m_tmp[i].create(width, height, -1, GL_RGBA16F);
|
||||
m_tex[i].create(width, height, GL_RGBA16F);
|
||||
#else
|
||||
m_tmp[i].create(width, height, -1, GL_RGBA32F);
|
||||
m_tex[i].create(width, height, GL_RGBA32F);
|
||||
@@ -917,8 +919,8 @@ bool ui::Canvas::create(int width, int height)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
#if __IOS__
|
||||
m_tmp[i].create(width, height, -1, GL_RGBA8);
|
||||
m_tex[i].create(width, height, GL_RGBA8);
|
||||
m_tmp[i].create(width, height, -1, GL_RGBA16F);
|
||||
m_tex[i].create(width, height, GL_RGBA16F);
|
||||
#else
|
||||
m_tmp[i].create(width, height, -1, GL_RGBA32F);
|
||||
m_tex[i].create(width, height, GL_RGBA32F);
|
||||
|
||||
Reference in New Issue
Block a user