XNA Creators Club Online
Page 1 of 1 (19 items)
Sort Posts: Previous Next

How to render multiple windows using multiple devices?

Last post 7/8/2009 5:18 AM by Rajeev Khatri. 18 replies.
  • 6/19/2009 6:31 AM

    How to render multiple windows using multiple devices?


    Hi all

    I am making an application using C# directX-9 in which I have to display multiple child windows in a parent window.I dont have knowledge about how to render multiple windows using multiple devices?

    Whenever I render the multiple windows only the focus windows show display and other windows shows blank.

    Please help.


    Thanks and Regards

    Rajeev Khatri
  • 6/19/2009 4:35 PM In reply to

    Re: How to render multiple windows using multiple devices?

    Which C# wrapper for Direct3D do you use and can you show some code? This way it might be easier to help you.
  • 6/20/2009 6:38 AM In reply to

    Re: How to render multiple windows using multiple devices?


    Hi

    Thanks for your reply.

    I am uploading the Sample Application. Here is the Link for the Sample application.

    http://www.panindiagroup.com/TIN%20Viewer3.rar

    Here just click the open button in the ToolStrip and select "Teste123.tri" file. Here you can see the display of the selected file and below you can see the screen shot of the selected file.

    http://www.panindiagroup.com/Sample%201.jpg

    Now again when you click open button. The display behind the open dialog box is invisible. Here is the Screen Shot of that problem.

    http://www.panindiagroup.com/Sample%201-A.jpg

    And when you select any file from Open file dialog box, another child window open just minimise the child window and you can see the problem. Here is the link for that problem.

    http://www.panindiagroup.com/Sample%201-B.jpg

    I have tried a lot. But it doesn't work.
    Please help.

    Thanks and Regards

    Rajeev Khatri


  • 6/20/2009 5:37 PM In reply to

    Re: How to render multiple windows using multiple devices?

    The old managed DirectX isn’t really supported anymore.

    You should use one of the open source solutions like Slimdx oder Managed Layer for Direct3D 10
  • 6/22/2009 8:27 AM In reply to

    Re: How to render multiple windows using multiple devices?


    Hi Ralf

    Have you seen the uploading files. Actually I am using DirectX-9 Version not DirectX-10.

    What is Slimdx? I dont have knowledge about this. Can you explain?
  • 6/27/2009 6:25 AM In reply to

    Re: How to render multiple windows using multiple devices?

    Sorry for the late answer

    The managed layer includes support for Direct3D 9, too.

    SlimDX is like the managed layer a replacement for the deprecated MDX. Have a look at http://slimdx.org/
  • 6/29/2009 2:43 AM In reply to

    Re: How to render multiple windows using multiple devices?

    In addition to what Ralf said, you really shouldn't be using multiple devices for this.  A single device can render to an arbitrary number of windows.

    You can create one swap chain per window, or you can create a single swap chain that is as large as the largest window you need to support and simply Present to that window directly.

    Devices are very heavyweight objects and there are very few reasons to create more than one of them.  Rendering to multiple windows is definately not one of those few reasons.
  • 6/30/2009 11:02 AM In reply to

    Re: How to render multiple windows using multiple devices?


    Thanks for your reply.

    Can you send me any sample code or sample application. So that i can understand.

    Actually I dont have knowledge of Swap Chain. I have tried a lot but didn,t get successful.

    please help me.

    Thanks and Regards

    Rajeev Khatri
  • 6/30/2009 2:54 PM In reply to

    Re: How to render multiple windows using multiple devices?

    Read Chapter 4. 2D Applications from my book The Direct3D Graphics Pipeline. That explains swap chains and Present. If its still unclear after reading that, ask more questions.
  • 6/30/2009 2:54 PM In reply to

    Re: How to render multiple windows using multiple devices?

    Look for rendering in multiple-viewports or on multiple monitors
  • 7/1/2009 11:12 AM In reply to

    Re: How to render multiple windows using multiple devices?


    Thanks for your reply.

    Acutally I am looking for rendering in Multiple windows not in Multiple monitors. Like i have to display multiple child windows in a Parent window. I have uploaded the sample application in the above Queries. you can check from there, What exactly the problem is? And book as you referred me, I am understanding about Swap Chain. Any Sample application or Sample Code for Swap Chain in C#.
  • 7/1/2009 2:14 PM In reply to

    Re: How to render multiple windows using multiple devices?

    If you use SlimDX its all the same.  I'm not sure about XNA.  You should not use Managed DirectX.
  • 7/2/2009 7:49 PM In reply to

    Re: How to render multiple windows using multiple devices?

    Yes, but the technique used for rendering on multiple monitors is also used to render to multiple windows. The swap chain is created for a particular HWND which is what the multimon example shows.
  • 7/5/2009 5:02 AM In reply to

    Re: How to render multiple windows using multiple devices?

    A swap chain doesn't require an HWND in windowed mode (which is what you need for multiple windows or multiple monitors that aren't in an adapter group device). You can supply the HWND when you call Present on the swap chain.

    Furthermore, multiple swap chains aren't needed to handle either multiple windows or multiple monitors. Its just one way of doing it. The default swap chain can Present to any HWND in windowed mode.

    Depending on your application architecture, it may be easier to manage a single swap chain (the default swap chain associated with a device) and simply use the viewport to restrict rendering to a portion of the back buffer, Present with an HWND and a RECT specifying the appropriate portion of your back buffer that matches the size of the window to which you're presenting.

  • 7/6/2009 7:27 AM In reply to

    Re: How to render multiple windows using multiple devices?


    Hello legalize

    Thanks for your reply.

    So you mean that we cant use swap chain for rendering multiple windows. Can you tell me any other way for rendering multiple windows. I have already mentioned in the above queries that what is the exact problem i am facing. Even i have uploaded a sample application with code and few .jpg image file in which you can easily analize the problem.

    Please Help.

    Thanks and Regards

    Rajeev Khatri
  • 7/7/2009 4:48 AM In reply to

    Re: How to render multiple windows using multiple devices?

    Rajeev Khatri:
    So you mean that we cant use swap chain for rendering multiple windows.


    Just the opposite.  You can use a swap chain for rendering to multiple windows.  You can use either the default swap chain on the device, a single additional swap chain for all windows (ignoring the default swap chain on the device), or you can use any number of swap chains for any number of windows and they don't need to be matched one to one.  The point is that the Present method, either on the IDirect3DDevice9 interface or on the IDirect3DSwapChain9 interface, takes an HWND argument that is used as the target of the presentation if you specify something other than zero.

    Can you tell me any other way for rendering multiple windows.


    Create a device with a back buffer that is as large as the largest window you need to draw.  Whenever you need to draw a window, set the viewport on the back buffer to the size of the window.  Clear the viewport and draw into it.  Call Present on the device with the handle of the window that needs to be drawn and the pSourceRect parameter pointing to a rectangle that is the size of the window.

    Poof.

    You can now redraw as many windows as you like with a single back buffer.  No extra swap chains needed.  Even better still, you'll end up with more video memory left over for your textures and other resources because you're sharing a single back buffer between all the windows instead of giving each window its own back buffer.

    Relevant link to Device.Present overload from SlimDX documentation:
    http://tinyurl.com/m4fb58

    A similar overload of Present is provided for the SwapChain class in SlimDX.
  • 7/7/2009 10:21 AM In reply to

    Re: How to render multiple windows using multiple devices?


    Hi Legalize

    Thanks for your reply.

    Can you send me any sample application with code or any example of swap chain. So that i can understand swap chain.

    I have searched a lot on Google but i haven't get any example or book regarding swap chain. I am making my application in C#.

    Please help.

    Thanks and Regards

    Rajeev Khatri
  • 7/7/2009 2:29 PM In reply to

    Re: How to render multiple windows using multiple devices?

    Did you read Chapter 4 from my book that I linked to above? That explains swap chains.

    With only 7 methods, the swap chain interface is one the smallest and simplest interfaces in Direct3D.

    Do you have a specific question?

  • 7/8/2009 5:18 AM In reply to

    Re: How to render multiple windows using multiple devices?


    Yes I read chapter 4 but this chapter is in different language, I think language is VC++. Thats why i didn't get. I am working on C#.
Page 1 of 1 (19 items) Previous Next