Git Product home page Git Product logo

Comments (11)

grokys avatar grokys commented on May 14, 2024

This should be pretty straightforward as Perspex uses DirectX11 (DIrect2D) for its drawing already and currently also draws on the UI thread.

One way to do this would be to add a hook added to the Perspex.Direct2D1.Renderer class which would pass the SharpDX.Direct2D1.RenderTarget. In this way DirectX would be able to draw where it wanted.

Another way would be to add something like a D3DImage class to Perspex.Direct2D1 which draws to an intermediate render target, and the is composited by Perspex.Direct2D1.Renderer.

If you would like to have a go, feel free to fork and play! Otherwise I will look into adding something like this soon.

from avalonia.

amerkoleci avatar amerkoleci commented on May 14, 2024

Yes thanks, i would use perspex for cross platform editor ui for my game engine and this is quite important, thanks again

from avalonia.

amerkoleci avatar amerkoleci commented on May 14, 2024

Note that would be good to have the possibility to embed OpenGL rendering even on Windows, so user can render OpenGL on Direct2D.
Probably this can be handled with WIN32 child window embedding.

from avalonia.

grokys avatar grokys commented on May 14, 2024

One thought: if you're using it for a game engine, wouldn't it be more useful if Perspex could draw into your DirectX render target?

from avalonia.

amerkoleci avatar amerkoleci commented on May 14, 2024

Yes, I can try to achieve some stuff and maybe report back.

from avalonia.

grokys avatar grokys commented on May 14, 2024

I've looked into this a little, but I could use some input on how you would like it to be used.

  • Would you prefer embedding of DirectX or Perspex to be embedded?
  • If embedding of DirectX, would you prefer having access to the render target or drawing to your own render target and having that composited onto the Perspex output.
  • How would you like to interact with the Perspex message loop?

from avalonia.

amerkoleci avatar amerkoleci commented on May 14, 2024

This is something I experiment with, probably need to think almost all ways, you can add D3DImage like where the
use can have DirectX11 or OpenGL and then draw the target bitmap using Direct2D.
But would be also good to have OpenGL like embedding (this means WIN32 child window) and do composition over Direct2D.
Under GTK only OpenGL can be done (there is something similar here, https://github.com/bchavez/SharpFlame).

Anyway wouldn't be better to go with GTK 3 instead of GTK 2, MonoDevelop started migration to GTK 3.

What do you think?

from avalonia.

grokys avatar grokys commented on May 14, 2024

Re: GTK3 - please start a new issue!

from avalonia.

tgjones avatar tgjones commented on May 14, 2024

This is completely the wrong place for this (although there is some loose connection to D3D), but just wanted to say, Perspex looks awesome! I've been wondering if I'll ever be able to make my Gemini framework cross-platform, and this is probably the most promising potential solution I've seen. I will be watching your progress with interest.

from avalonia.

grokys avatar grokys commented on May 14, 2024

Thanks Tim, yes completely the wrong place, but please come join us in our gitter room! https://gitter.im/grokys/Perspex

from avalonia.

danwalmsley avatar danwalmsley commented on May 14, 2024

opengl and native program embedding is now merged.

from avalonia.

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.