use PBO for timelapse data read

This commit is contained in:
2019-11-05 18:25:25 +01:00
parent 4b6316bf68
commit 52ad58aec4
8 changed files with 212 additions and 9 deletions

View File

@@ -101,6 +101,49 @@ Texture2D Layer::gen_equirect(glm::ivec2 size /*= { 0, 0 }*/)
return ret;
}
PBO Layer::gen_equirect_pbo(glm::ivec2 size /*= { 0, 0 }*/)
{
PBO pbo;
App::I->render_task([&]
{
gl_state gl;
gl.save();
TextureCube cube;
RTT latlong;
if (size.x == 0 || size.y == 0)
size = { w, h };
cube = gen_cube();
latlong.create(size.x * 4, size.y * 2);
glDisable(GL_BLEND);
latlong.bindFramebuffer();
latlong.clear({ 0, 1, 1, 1 });
glViewport(0, 0, latlong.getWidth(), latlong.getHeight());
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_CUBE_MAP, cube.m_cubetex_id);
ShaderManager::use(kShader::Equirect);
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
ShaderManager::u_int(kShaderUniform::Tex, 0);
Canvas::I->m_sampler.bind(0);
Canvas::I->m_plane.draw_fill();
latlong.unbindFramebuffer();
pbo.create(latlong);
latlong.destroy();
cube.destroy();
gl.restore();
});
return pbo;
}
void Layer::destroy()
{
for (int i = 0; i < 6; i++)