Advertisement

SharpDX RenderLoop.Run with multiple tabs

Started by March 03, 2018 10:11 PM
3 comments, last by ChuckNovice 6 years, 11 months ago

I have a multi-tab application.
Each tab is a form which has a single control window for sharpDX.
I am using RenderLoop.Run(control, someFunc) to update the graphics on each tab.
Each tab works correctly when created but the previously created tab no longer updates the graphics window because it appears RenderLoop.Run on that tab is no longer being called.
Each new tab when created appears to replace the previous RenderLoop.
The tabs are can also be undocked so more than one may be visible at once.
Any tab can be closed so I have no guarantee that any one tab will be there.
How should I solve the problem?
Should I use a Timer instead?

sjc

Why do you have multiple render loops? You should have a single render loop and all of your tabs are just viewports which that renderloop handles.

You could then have some basic logic in your tabs to simply enable/disable those instances from rendering when they're not visible.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Advertisement

Are you suggesting that I run it in the parent form since none of the child tabs which display the graphics are persistent?

sjc

23 hours ago, Steven Cohn said:

Are you suggesting that I run it in the parent form since none of the child tabs which display the graphics are persistent?

Yes and no. Putting such logic in a form or any UI is always a bad idea but yes the idea is to have the render loop happening at only one place and requesting each viewport to render once per loop iteration.

 

You can simply have a class instance that manage that big loop and you registrer one or many renderer to it as they are created. The big loop simply have to request each registered object to render once per iteration.

This topic is closed to new replies.

Advertisement