From c321d76b3e28126cdb6e6975a094005e32550077 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 11 Dec 2017 23:48:56 -0500 Subject: [PATCH] Add try/catch blocks around the rendering to detect excess of texture units (closes #427) --- apps/OpenSpace/main.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 0e3594f689..efcf2675dc 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -351,25 +351,34 @@ void mainRenderFunc() { } #endif - OsEng.render( - SgctEngine->getModelMatrix(), - viewMatrix, - projectionMatrix - ); + try { + OsEng.render( + SgctEngine->getModelMatrix(), + viewMatrix, + projectionMatrix + ); + } + catch (const ghoul::RuntimeError& e) { + LERRORC(e.component, e.message); + } LTRACE("main::mainRenderFunc(end)"); } void mainDraw2DFunc() { LTRACE("main::mainDraw2DFunc(begin)"); - OsEng.drawOverlays(); + try { + OsEng.drawOverlays(); + } + catch (const ghoul::RuntimeError& e) { + LERRORC(e.component, e.message); + } // SGCT gets angry if we change this in our function glEnable(GL_BLEND); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); - LTRACE("main::mainDraw2DFunc(end)"); }