add vr_draw_ui method and make ui observer as method to be wildly available

This commit is contained in:
2019-05-29 22:41:37 +02:00
parent 9d6bb0187e
commit d750f80482
4 changed files with 66 additions and 44 deletions

View File

@@ -23,6 +23,23 @@ void App::vr_stop()
#endif
}
void App::vr_draw_ui()
{
if (auto* main = layout[main_id])
main->update(width, height, zoom);
uirtt.bindFramebuffer();
uirtt.clear();
glViewport(0, 0, uirtt.getWidth(), uirtt.getHeight());
glEnable(GL_SCISSOR_TEST);
auto observer = std::bind(&App::update_ui_observer, this, std::placeholders::_1);
for (int i = 1; i < layout[main_id]->m_children.size(); i++)
layout[main_id]->m_children[i]->watch(observer);
//msgbox->watch(observer);
glDisable(GL_SCISSOR_TEST);
uirtt.unbindFramebuffer();
}
void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat4& pose)
{
//glm::mat4 ortho_proj = glm::ortho(0.f, box.z, 0.f, box.w, -1000.f, 1000.f);