소스 검색

Render a couple of extra frames before idling, to accomodate ImGui's immediate mode rendering.

Former-commit-id: fa8d913b4bf450ba37ff99f836a9a799ad309517
Jérémie Dumas 7 년 전
부모
커밋
48f9aea3a9
3개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 1
      include/igl/opengl/glfw/Viewer.cpp
  2. 1 1
      tutorial/106_ViewerMenu/main.cpp
  3. 0 1
      tutorial/107_MultipleMeshes/main.cpp

+ 4 - 1
include/igl/opengl/glfw/Viewer.cpp

@@ -268,12 +268,14 @@ namespace glfw
   {
     // glfwMakeContextCurrent(window);
     // Rendering loop
+    const int num_extra_frames = 5;
+    int frame_counter = 0;
     while (!glfwWindowShouldClose(window))
     {
       double tic = get_seconds();
       draw();
       glfwSwapBuffers(window);
-      if(core.is_animating)
+      if(core.is_animating || frame_counter++ < num_extra_frames)
       {
         glfwPollEvents();
         // In microseconds
@@ -287,6 +289,7 @@ namespace glfw
       else
       {
         glfwWaitEvents();
+        frame_counter = 0;
       }
       if (!loop)
         return !glfwWindowShouldClose(window);

+ 1 - 1
tutorial/106_ViewerMenu/main.cpp

@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
 
   // Attach a custom menu
   MyMenu menu;
-  viewer.core.is_animating = true;
+  // viewer.core.is_animating = true;
   viewer.plugins.push_back(&menu);
 
   // Plot the mesh

+ 0 - 1
tutorial/107_MultipleMeshes/main.cpp

@@ -48,7 +48,6 @@ int main(int argc, char * argv[])
 
   // Attach a custom menu
   MyMenu menu;
-  viewer.core.is_animating = true;
   viewer.plugins.push_back(&menu);
 
   // Color each mesh differently