How to simultaneously visualize and render offscreen? #35
-
(Sorry for cross posting from Issues!) Referring to https://roboti.us/forum/index.php?threads/how-to-simultaneously-visualize-and-render-offscreen.3517/ which was not resolved completely. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hello, did you resolve this? Rendering two camera views should not be a problem, though indeed with glfw you might need to open a second window, I don't remember the details of glfw's support for windowless rendering. |
Beta Was this translation helpful? Give feedback.
-
@yuvaltassa You can compile by doing and run by doing Any guidance on modifying this for windowed + offscreen rendering would be very very helpful. Thank you in advance! |
Beta Was this translation helpful? Give feedback.
-
If you can render to two windows with GLFW, to my knowledge the only thing you still need is to start the second window invisible with glfwWindowHint(GLFW_VISIBLE, 0) as in record.cc. If I understand the documentation correctly there is another way for offscreen rendering already implemented which skips GLFW. |
Beta Was this translation helpful? Give feedback.
If you can render to two windows with GLFW, to my knowledge the only thing you still need is to start the second window invisible with glfwWindowHint(GLFW_VISIBLE, 0) as in record.cc.
If I understand the documentation correctly there is another way for offscreen rendering already implemented which skips GLFW.
In the model xml you can define offheight and offwidth for the visual element, which determines the size of the offscreen buffer.
After rendering your main window you mjr_setBuffer to OFFSCREEN, render again, and mjr_readPixels, before setting the buffer back again. This way you do not have to open two GLFW windows or contexts.