DisplayMode::OnRenderSizeChanged: How to sync with renderer?

I am building a test custom renderer in order to understand how the rhino rendering pipeline works.
Now I am focused on the render resize event. Based on the SampleRealTimeRenderer example, I have managed to make almost everything working:

  • Any type of resize in the viewport area
  • Any type of resize in the tool bar areas, etc
  • Minimize/Maximize/Restore the whole Rhino window
  • Horizontal/Vertical resize of the whole Rhino window

What does not work is the diagonal resize of the Rhino window.
If it try it, the whole window hangs and becomes unresponsive. I have to press alt+tab to the VS in order to see my cursor turn back to normal instead of the “diagonal” arrow symbol.

There are three cases when the diagonal rhino window resize works as smoothly as in the SampleRealTimeRenderer:

  • When change the size of the window very-very slowly
  • When I insert a breakpoint in the DisplayMode and the press continue, but this allows me very little change of the size just like case 1 above
  • When the scene geometry is large. In this case I don’t get crash or hang. If I render just a cube I immediately have my system hang.

I know, that without the actual code, there cannot be any significant help, but somehow I suspect that there is something related with the synchronization between DisplayMode and the renderer.

Any tip/advice/example on this would be more than useful
Thanks!

For synchronization between renderer and the document you should implement a changequeue: rhino-developer-samples/cpp/SampleChangeQueue at 8 · mcneel/rhino-developer-samples · GitHub

That together with the realtime display implementation should do what you need.

RhinoCycles ( GitHub - mcneel/RhinoCycles: The Cycles integration plug-in for Rhinoceros 3D ) implements these on top of RhinoCommon, but it should be very similar in C++. I hope the code can be used as inspiration and give enough info on how to achieve a renderer integration.