Browse Source

Make teseo happy.

Jérémie Dumas 6 years ago
parent
commit
8eac86c163

+ 7 - 5
include/igl/opengl/glfw/Viewer.cpp

@@ -123,16 +123,18 @@ namespace opengl
 namespace glfw
 {
 
-  IGL_INLINE int Viewer::launch(bool resizable /*= true*/,bool fullscreen /*= false*/, int windowWidth /*= 1280*/, int windowHeight /*= 800*/)
+  IGL_INLINE int Viewer::launch(bool resizable /*= true*/, bool fullscreen /*= false*/,
+    const std::string &name, int windowWidth /*= 1280*/, int windowHeight /*= 800*/)
   {
     // TODO return values are being ignored...
-    launch_init(resizable,fullscreen,windowWidth,windowHeight);
+    launch_init(resizable,fullscreen,name,windowWidth,windowHeight);
     launch_rendering(true);
     launch_shut();
     return EXIT_SUCCESS;
   }
 
-  IGL_INLINE int  Viewer::launch_init(bool resizable,bool fullscreen, int windowWidth, int windowHeight)
+  IGL_INLINE int  Viewer::launch_init(bool resizable, bool fullscreen,
+    const std::string &name, int windowWidth, int windowHeight)
   {
     glfwSetErrorCallback(glfw_error_callback);
     if (!glfwInit())
@@ -150,11 +152,11 @@ namespace glfw
     {
       GLFWmonitor *monitor = glfwGetPrimaryMonitor();
       const GLFWvidmode *mode = glfwGetVideoMode(monitor);
-      window = glfwCreateWindow(mode->width,mode->height,"libigl viewer",monitor,nullptr);
+      window = glfwCreateWindow(mode->width,mode->height,name.c_str(),monitor,nullptr);
     }
     else
     {
-      window = glfwCreateWindow(windowWidth,windowHeight,"libigl viewer",nullptr,nullptr);
+      window = glfwCreateWindow(windowWidth,windowHeight,name.c_str(),nullptr,nullptr);
     }
     if (!window)
     {

+ 2 - 2
include/igl/opengl/glfw/Viewer.h

@@ -45,8 +45,8 @@ namespace glfw
     // UI Enumerations
     enum class MouseButton {Left, Middle, Right};
     enum class MouseMode { None, Rotation, Zoom, Pan, Translation} mouse_mode;
-    IGL_INLINE int launch(bool resizable = true,bool fullscreen = false, int width = 1280, int height = 800);
-    IGL_INLINE int launch_init(bool resizable = true,bool fullscreen = false, int width = 1280, int height = 800);
+    IGL_INLINE int launch(bool resizable = true, bool fullscreen = false, const std::string &name = "libigl viewer", int width = 1280, int height = 800);
+    IGL_INLINE int launch_init(bool resizable = true, bool fullscreen = false, const std::string &name = "libigl viewer", int width = 1280, int height = 800);
     IGL_INLINE bool launch_rendering(bool loop = true);
     IGL_INLINE void launch_shut();
     IGL_INLINE void init();

+ 6 - 2
python/modules/py_igl_opengl_glfw.cpp

@@ -388,8 +388,12 @@ py::class_<igl::opengl::ViewerCore> viewercore_class(me, "ViewerCore");
     .def_readwrite("screen", &igl::opengl::glfw::Viewer::screen)
     #endif
 
-    .def("launch", &igl::opengl::glfw::Viewer::launch, py::arg("resizable") = true, py::arg("fullscreen") = false, py::arg("windowWidth") = 1280, py::arg("windowHeight") = 800)
-    .def("launch_init", &igl::opengl::glfw::Viewer::launch_init, py::arg("resizable") = true, py::arg("fullscreen") = false, py::arg("windowWidth") = 1280, py::arg("windowHeight") = 800)
+    .def("launch", &igl::opengl::glfw::Viewer::launch, py::arg("resizable") = true,
+      py::arg("fullscreen") = false, py::arg("name") = "libigl viewer",
+      py::arg("windowWidth") = 1280, py::arg("windowHeight") = 800)
+    .def("launch_init", &igl::opengl::glfw::Viewer::launch_init, py::arg("resizable") = true,
+      py::arg("fullscreen") = false, py::arg("name") = "libigl viewer",
+      py::arg("windowWidth") = 1280, py::arg("windowHeight") = 800)
     .def("launch_rendering", &igl::opengl::glfw::Viewer::launch_rendering, py::arg("loop") = true)
     .def("launch_shut", &igl::opengl::glfw::Viewer::launch_shut)
     .def("init", &igl::opengl::glfw::Viewer::init)