refactoring vr code

This commit is contained in:
2019-05-31 23:02:53 +02:00
parent d2a62df5c7
commit 20582dafa8
6 changed files with 138 additions and 117 deletions

View File

@@ -110,7 +110,6 @@ bool App::request_close()
void App::clear()
{
glClearColor(.1f, .1f, .1f, 1.f);
glViewport(off_x, off_y, (GLsizei)width, (GLsizei)height);
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -588,11 +587,6 @@ void App::update(float dt)
if (!(redraw || animate))
return;
//glClearColor(.1f, .1f, .1f, 1.f);
//glViewport(0, 0, (GLsizei)width, (GLsizei)height);
//glClear(GL_COLOR_BUFFER_BIT);
//if (!canvas->m_mouse_captured)
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
reload_timer += dt;
if (reload_timer > 1.0)
@@ -634,6 +628,7 @@ void App::update(float dt)
{
uirtt.bindFramebuffer();
uirtt.clear();
glViewport(0, 0, uirtt.getWidth(), uirtt.getHeight());
glEnable(GL_SCISSOR_TEST);
for (int i = 1; i < layout[main_id]->m_children.size(); i++)
layout[main_id]->m_children[i]->watch(observer);
@@ -641,29 +636,21 @@ void App::update(float dt)
glDisable(GL_SCISSOR_TEST);
uirtt.unbindFramebuffer();
}
#if __IOS__
[ios_view->glview bindDrawable];
#else
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#endif
glEnable(GL_SCISSOR_TEST);
for (int i = 0; i < layout[main_id]->m_children.size(); i++)
layout[main_id]->m_children[i]->watch(observer);
//msgbox->watch(observer);
glDisable(GL_SCISSOR_TEST);
//canvas->watch(observer);
//glEnable(GL_BLEND);
//sampler.bind(0);
//ShaderManager::use(kShader::Texture);
//ShaderManager::u_int(kShaderUniform::Tex, 0);
//ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-1.f, 1.f, -1.f, 1.f));
//glActiveTexture(GL_TEXTURE0);
//uirtt.bindTexture();
//m_face_plane.draw_fill();
//uirtt.unbindTexture();
//glDisable(GL_BLEND);
if (!vr_only)
{
#if __IOS__
[ios_view->glview bindDrawable];
#else
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#endif
glViewport(off_x, off_y, (GLsizei)width, (GLsizei)height);
glEnable(GL_SCISSOR_TEST);
for (int i = 0; i < layout[main_id]->m_children.size(); i++)
layout[main_id]->m_children[i]->watch(observer);
//msgbox->watch(observer);
glDisable(GL_SCISSOR_TEST);
}
if (rec_running)
{