render task queue the color pick action
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user