|
@@ -725,10 +725,9 @@ namespace viewer
|
|
|
this->save_mesh_to_file(fname.c_str());
|
|
|
}
|
|
|
|
|
|
- IGL_INLINE int Viewer::launch(bool resizable,bool fullscreen)
|
|
|
- {
|
|
|
- GLFWwindow* window;
|
|
|
|
|
|
+ IGL_INLINE int Viewer::launch_init(bool resizable,bool fullscreen)
|
|
|
+ {
|
|
|
glfwSetErrorCallback(glfw_error_callback);
|
|
|
if (!glfwInit())
|
|
|
return EXIT_FAILURE;
|
|
@@ -817,7 +816,12 @@ namespace viewer
|
|
|
|
|
|
// Initialize IGL viewer
|
|
|
init();
|
|
|
+ }
|
|
|
|
|
|
+ IGL_INLINE bool Viewer::launch_rendering(bool loop)
|
|
|
+ {
|
|
|
+ glfwMakeContextCurrent(window);
|
|
|
+
|
|
|
// Rendering loop
|
|
|
while (!glfwWindowShouldClose(window))
|
|
|
{
|
|
@@ -840,8 +844,14 @@ namespace viewer
|
|
|
{
|
|
|
glfwWaitEvents();
|
|
|
}
|
|
|
+
|
|
|
+ if (!loop)
|
|
|
+ return !glfwWindowShouldClose(window);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ IGL_INLINE void Viewer::launch_shut()
|
|
|
+ {
|
|
|
opengl.free();
|
|
|
core.shut();
|
|
|
|
|
@@ -849,7 +859,14 @@ namespace viewer
|
|
|
|
|
|
glfwDestroyWindow(window);
|
|
|
glfwTerminate();
|
|
|
- return EXIT_SUCCESS;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ IGL_INLINE int Viewer::launch(bool resizable,bool fullscreen)
|
|
|
+ {
|
|
|
+ launch_init(resizable,fullscreen);
|
|
|
+ launch_rendering(true);
|
|
|
+ launch_shut();
|
|
|
}
|
|
|
} // end namespace
|
|
|
}
|