Giter VIP home page Giter VIP logo

Comments (6)

turanszkij avatar turanszkij commented on September 27, 2024

You will need 3 swap chains, one for each window, and then draw to the swapchain that you want. This is not implemented in the Application class, but there you can see how to create swap chains and how to draw to them.

from wickedengine.

Geniok avatar Geniok commented on September 27, 2024

Yes, I added std::vector<wi::graphics::SwapChain> swapChains there.
Do I need to use std::vector<wi::platform::window_type> windows or can I get by with just wi::platform::window_type ?

My current idea is that for each wi::platform::window_type you need to have your own wi::graphics::SwapChain, your own wi::Canvas and your own wi::graphics::SwapChainDesc.

And in the OnRender() method for each SwapChain:

for (auto& swapChain : swapChains)
{
    CommandList cmd = m_graphicsDevice->BeginCommandList();
    wi::image::SetCanvas(canvas);
    wi::font::SetCanvas(canvas);
    Viewport viewport;
    viewport.width = (float)swapChain->desc.width;
    viewport.height = (float)swapChain->desc.height;
    m_graphicsDevice->BindViewports(1, &viewport, cmd);
    m_graphicsDevice->RenderPassBegin(swapChain.get(), cmd);
    m_graphicsDevice->RenderPassEnd(cmd);

    wi::input::ClearForNextFrame();
    wi::profiler::EndFrame(cmd);
    m_graphicsDevice->SubmitCommandLists();
}

But I'm not sure how correct it is.

from wickedengine.

turanszkij avatar turanszkij commented on September 27, 2024

You will need one window for each swap chain. These things in your snippet should be called only once per frame, not for every swapchain:

wi::input::ClearForNextFrame();
wi::profiler::EndFrame(cmd);
m_graphicsDevice->SubmitCommandLists();

from wickedengine.

Geniok avatar Geniok commented on September 27, 2024

Thank you, everything worked out great!

Another question, is it possible to make each SwapChain display its own scene?

from wickedengine.

turanszkij avatar turanszkij commented on September 27, 2024

This is a matter of what you draw into it, so yes. Probably the easiest way would be to use a different scene for each and a different RenderPath3D for each, and drawing the each renderpath's result into the corresponding swapchain. You can set renderpath's scene member pointer to the scene you want to render.

from wickedengine.

Geniok avatar Geniok commented on September 27, 2024

Thank you!

I'll try to implement it.
I think we can close the issue.

from wickedengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.