render task queue the color pick action

This commit is contained in:
2019-07-28 12:11:23 +02:00
parent 36be53aba5
commit 37331d4e24

View File

@@ -72,6 +72,8 @@ void Canvas::pick_update(int plane)
if (m_pick_ready[plane])
return;
App::I->render_task([this, plane]
{
// save viewport and clear color states
GLint vp[4];
GLfloat cc[4];
@@ -105,7 +107,7 @@ void Canvas::pick_update(int plane)
m_sampler.unbind();
if (!m_pick_data[plane])
m_pick_data[plane] = std::make_unique<glm::u8vec4[]>(m_width*m_height);
m_pick_data[plane] = std::make_unique<glm::u8vec4[]>(m_width * m_height);
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_pick_data[plane].get());
m_tmp[i].unbindFramebuffer();
@@ -114,7 +116,7 @@ void Canvas::pick_update(int plane)
glViewport(vp[0], vp[1], vp[2], vp[3]);
glClearColor(cc[0], cc[1], cc[2], cc[3]);
glActiveTexture(GL_TEXTURE0);
});
m_pick_ready[plane] = true;
}