Multiple windows by one device

Hi!

I'm looking for some easy way to render into multiple widows by only one device. I'm using managed directX in C#, there's an overload of the Present method that takes a control and claims that it will draw onto the control, but I can't make it work. It does not fail, but neither does it draw anything. Could you please tell me what I'm doing wrong, or maybe weather there's some easier way to do that

Thanks

Libor


Answer this question

Multiple windows by one device

  • harveyDBA

    I've been asking about rendering into two windows, I'll check the swap chains stuff, could you please be a little bit more specific about where to start looking

    Thanks.

  • Dave Tormey

    I'm not 100% sure if you are asking 2 questions or confused about one thing.

    1. Rendering into a control means you have to pass the window handle of that control in at device creation. There are a couple of samples in managed code http://www.thezbuffer.com/articles/310.aspx and http://www.thezbuffer.com/articles/306.aspx

    2. Rendering into mutliple windows withour recreating the device. Search for swap chains. I'm not aware of any c# samples that show this but you should be able to find C++ code.

  • Srinivas Raju

    You can render to 2 windows without swap chains, though I gather perf can suffer.

    I don't have a recommended source - try google http://www.google.com/search hl=en&q=swap+chain

    Robert has an article http://www.mvps.org/directx/articles/rendering_to_multiple_windows.htm on that list and his stuff is usually good. Though that looks like an old article.

  • amitatbangalore

    OK I fixed my problem... you should be OK as long as your inital back buffer is big enough... anyways one other problem I had that sounded kinda like yours was when I had a panel with a sub panel I couldnt render to the parent panel, but rendering to the child was perfect (it had no child controls).

  • Jeff2005



    foreach (TargetSettings t in settings.SecondaryTargets) {
                        currentTargetSettings = t;
                        AdjustCameraForCurrentTarget();
                        device.Clear(ClearFlags.Target, System.Drawing.Color.Red, 1.0f, 0);
                        device.BeginScene();
                        spriter.Begin(SpriteFlags.AlphaBlend);
                        currentTargetSettings.Renderer.Render(this);
                        spriter.End();
                        device.EndScene();
                        device.Present(t.Target);


    }

     


    Here is how I used the Present method to draw to a second control... but ahh I am having trouble with this.  It works KINDA, but the image is way distorted based on the sizes of the primary device target and this override target (the arg to Present).

  • noelweichbrodt

    http://www.fairyengine.com/

     Look in Articles section for swap chains

  • Multiple windows by one device