@@ -233,7 +233,8 @@ void GLFWDisplaySystem::run()
233233 dc.renderer = myRenderer;
234234 Timer t;
235235 t.start ();
236- while (!SystemManager::instance ()->isExitRequested ())
236+ bool tileEnabled = true ;
237+ while (!SystemManager::instance ()->isExitRequested ())
237238 {
238239 uc.frameNum = frame;
239240 uc.time = t.getElapsedTimeInSec ();
@@ -268,31 +269,41 @@ void GLFWDisplaySystem::run()
268269
269270 myEngine->update (uc);
270271
271- glfwMakeContextCurrent (window);
272-
273- // Handle window resize
274- int width, height;
275- glfwGetFramebufferSize (window, &width, &height);
276-
277- if (tile->activeRect .width () != width ||
278- tile->activeRect .height () != height)
272+ if (tile->enabled != tileEnabled)
279273 {
280- Vector2i ws (width, height);
281- tile->activeRect .max = tile->activeRect .min + ws;
282- tile->pixelSize = ws;
283- tile->activeCanvasRect .max = ws;
284- tile->displayConfig .setCanvasRect (tile->activeCanvasRect );
274+ tileEnabled = tile->enabled ;
275+ if (tileEnabled) glfwShowWindow (window);
276+ else glfwHideWindow (window);
285277 }
286- myRenderer->prepare (dc);
287- oassert (!oglError);
288278
289- // Enable lighting by default (expected by native osg applications)
290- // We might want to move this into the omegaOsg render pass if this
291- // causes problems with other code.
292- if (!dcfg.openGLCoreProfile ) glEnable (GL_LIGHTING);
279+ if (tileEnabled)
280+ {
281+ glfwMakeContextCurrent (window);
293282
294- dc.drawFrame (frame++);
295- glfwSwapBuffers (window);
283+ // Handle window resize
284+ int width, height;
285+ glfwGetFramebufferSize (window, &width, &height);
286+
287+ if (tile->activeRect .width () != width ||
288+ tile->activeRect .height () != height)
289+ {
290+ Vector2i ws (width, height);
291+ tile->activeRect .max = tile->activeRect .min + ws;
292+ tile->pixelSize = ws;
293+ tile->activeCanvasRect .max = ws;
294+ tile->displayConfig .setCanvasRect (tile->activeCanvasRect );
295+ }
296+ myRenderer->prepare (dc);
297+ oassert (!oglError);
298+
299+ // Enable lighting by default (expected by native osg applications)
300+ // We might want to move this into the omegaOsg render pass if this
301+ // causes problems with other code.
302+ if (!dcfg.openGLCoreProfile ) glEnable (GL_LIGHTING);
303+
304+ dc.drawFrame (frame++);
305+ glfwSwapBuffers (window);
306+ }
296307
297308 // Poll the service manager for new events.
298309 im->poll ();
0 commit comments