RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
982 stars 178 forks source link

Reported progress starts at 100% #501

Closed paulmelis closed 2 years ago

paulmelis commented 2 years ago

I thought a test I was doing finished rendering very quickly (progress jumped to 1.0 immediately) and then got stuck on finishing the frame, but with 2.7.0 it seems the first reported progress values are 1.0 initially. Perhaps it only gets set to 0 the moment rendering really starts?

diff --git a/apps/ospTutorial/ospTutorial.cpp b/apps/ospTutorial/ospTutorial.cpp
index 276ba7b9b..c8921278e 100644
--- a/apps/ospTutorial/ospTutorial.cpp
+++ b/apps/ospTutorial/ospTutorial.cpp
@@ -129,7 +129,12 @@ int main(int argc, const char **argv)
     framebuffer.clear();

     // render one frame
-    framebuffer.renderFrame(renderer, camera, world);
+    ospray::cpp::Future f = framebuffer.renderFrame(renderer, camera, world);
+    while (!f.isReady())
+    {
+        printf("%.1f\n", f.progress());
+        usleep(500);
+    }

     // access framebuffer and write its content as PPM file
     uint32_t *fb = (uint32_t *)framebuffer.map(OSP_FB_COLOR);

With the above patch and some heavy load on the system the progress reported 1.0 more than once:

melis@juggle 21:57:~/c/ospray-git/apps/ospTutorial$ ./ospTutorial
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.1
0.2
0.2
0.3
0.3
0.4
0.4
0.4
0.4
0.4
0.4
0.4
0.4
0.4
0.4
0.5
0.6
0.6
0.6
0.6
0.8