locked
DirectX rendering within a Metro app RRS feed

  • Question

  • Hi,

    I'm trying to figure the best way to get the DirectX functionality I need into a Metro app. It isn't a game (which is why I haven't posted this on the games forum), but it would need to render DirectX content into a rectangular subregion of the screen. I've had a look at the Metro DirectX samples, which use CoreApplicationView and CoreWindow objects, with the swap chain being connected to the core window. However, the samples all seem to be fullscreen, so I'm wondering if fullscreen is a limitation of the CoreApplicationView/CoreWindow approach, or can I set up the DirectX swap chain so that it applies to only part of the screen?

    If that's not allowed, maybe I need to render to a texture and forget about the swap chain, and then somehow convert the texture to a bitmap/image and then place that in the appropriate area of the screen?

    Thank for any advice.

    Robert

    Monday, June 4, 2012 2:58 PM

Answers

  • Hi, it seems to me that you can resize the swapchain or restrict the output to a specific area.

    Maybe SurfaceImageSource and SwapChainBackgroundPanel is more what you want.

    DirectX and XAML interop (Metro style apps using C++ and DirectX)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx
    • Proposed as answer by Jesse Jiang Tuesday, June 5, 2012 7:57 AM
    • Marked as answer by RobertHF Tuesday, June 5, 2012 10:34 AM
    Monday, June 4, 2012 3:51 PM
  • You will need to render your DirectX image into a SurfaceImageSource or VirtualSurfaceImageSource and then display that within your Xaml. Using DX to render to the CoreWindow and a SwapChainBackgroundPanel is designed for full screen DX with small amounts of Xaml rather than the other way around.

    See DirectX and XAML interop (Metro style apps using C++ and DirectX) for more information on the differences and how to use each of these options.

    --Rob

    • Proposed as answer by Jesse Jiang Tuesday, June 5, 2012 7:57 AM
    • Marked as answer by RobertHF Tuesday, June 5, 2012 10:34 AM
    Monday, June 4, 2012 8:43 PM
    Moderator

All replies

  • Hi, it seems to me that you can resize the swapchain or restrict the output to a specific area.

    Maybe SurfaceImageSource and SwapChainBackgroundPanel is more what you want.

    DirectX and XAML interop (Metro style apps using C++ and DirectX)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx
    • Proposed as answer by Jesse Jiang Tuesday, June 5, 2012 7:57 AM
    • Marked as answer by RobertHF Tuesday, June 5, 2012 10:34 AM
    Monday, June 4, 2012 3:51 PM
  • You will need to render your DirectX image into a SurfaceImageSource or VirtualSurfaceImageSource and then display that within your Xaml. Using DX to render to the CoreWindow and a SwapChainBackgroundPanel is designed for full screen DX with small amounts of Xaml rather than the other way around.

    See DirectX and XAML interop (Metro style apps using C++ and DirectX) for more information on the differences and how to use each of these options.

    --Rob

    • Proposed as answer by Jesse Jiang Tuesday, June 5, 2012 7:57 AM
    • Marked as answer by RobertHF Tuesday, June 5, 2012 10:34 AM
    Monday, June 4, 2012 8:43 PM
    Moderator
  • t-n-x, Rob,

    Thanks for the information. Things are better than I thought.

    Robert

    Tuesday, June 5, 2012 10:36 AM