Git Product home page Git Product logo

Comments (2)

flibitijibibo avatar flibitijibibo commented on June 24, 2024

Is this something you're doing in XNA or is this something you're trying to do with a new FNA project?

XNA supported extra windows in a way, but a lot of it dealt with the user allocating their own Win32 HWND and stapling it to functions where it was needed. We can do this as well, but with SDL_Window* pointers.

For the mouse, this will be fixed in SDL 2.0.4 where we'll have access to SDL_GetGlobalMouseState, where the position will then be calculated with the current Mouse.WindowHandle position. For now, the best you'll get is setting the WindowHandle and then using SetPosition to warp the mouse to the window, where I believe it should give proper coordinates. (That, or you can request focus with SDL_RaiseWindow.)

The Graphics subsystem is where compatibility will get interesting due to the nature of GL contexts.

Like D3D, a GraphicsDevice is storing its own rendering context, along with a window pointer to present to. You could attempt to use a single GraphicsDevice on multiple windows by getting ugly with SDL_GL_MakeCurrent, but calls to SDL_GL_MakeCurrent are very very slow (and often unstable) and you probably want to avoid it. This might be possible to do on FNA's end, but again, this would be entirely at your own risk... you'd have to swap out the contexts in these places:

Unset GLDevice window, set overrideWindowHandle, undo when complete (4 MakeCurrents):
https://github.com/flibitijibibo/FNA/blob/master/src/Graphics/OpenGLDevice.cs#L873

Unset GLDevice window, assign new window from PresentationParameters, set (2 MakeCurrents):
https://github.com/flibitijibibo/FNA/blob/master/src/Graphics/OpenGLDevice.cs#L807

Reset THREADED_GL, where applicable (init is at this location):
https://github.com/flibitijibibo/FNA/blob/master/src/Graphics/OpenGLDevice.cs#L4570

A slightly easier way to deal with all of this is to just use a second GraphicsDevice next to the second window, and use that GraphicsDevice independently of the rest of XNA (load your own textures/buffers/etc.), and call GraphicsDevice.Present() when the frame is ready.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on June 24, 2024

Closing due to old age.

from fna-mghistory.

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.