My engine runs in C++ and uses DirectX11. I have a C# editor and a Managed C++ ‘shim’ library that sits in between the two which allows me to drive and render the engine from my C# editor.
What I've been doing for a while in C# is, on ApplicationIdle, calling my engine's render code for each view that is registered. I have several of these, including a scene editor view, a material editor view, material sample view, etc. The only view I'd like to render as fast as possible is the scene editor view but I'm also rendering the Material Editor window too, even when nothing's happening in there.
What I'd like to do is somehow only render to the Material Editor window when the control needs to be invalidated or when the mouse down event is registered and the mouse is moving, i.e. you're moving something around in the Material Editor window. The reason for this is that when you have a complex material loaded (a bit like Unreal's material editor), it slows down the render of the scene editor window because both are being rendered as fast as possible.
I've tried various OnPaint stuff in C# to try only render the Material Editor window when it needs it but for some reason it seems to render for a split second and then just go grey. Like somehow the engine as rendered to the control in the OnPaint but then it somehow gets over-rendered by the C# control. I find all this paint event stuff in C# a bit black-boxy, so is there a better way to do this?