Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow embedding into Perspex #6

Closed
amerkoleci opened this issue Dec 5, 2014 · 11 comments
Closed

Allow embedding into Perspex #6

amerkoleci opened this issue Dec 5, 2014 · 11 comments

Comments

@amerkoleci
Copy link
Contributor

I would like to embed my DirectX11 rendering widget inside the application, in WPF is done using D3DImage or WindowsForms host using interop, how would this be possible here?

Same logic goes on GTK with OpenGL.

@grokys
Copy link
Member

grokys commented Dec 5, 2014

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.

@amerkoleci
Copy link
Contributor Author

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

@amerkoleci
Copy link
Contributor Author

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.

@grokys
Copy link
Member

grokys commented Dec 5, 2014

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?

@amerkoleci
Copy link
Contributor Author

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

@grokys
Copy link
Member

grokys commented Dec 9, 2014

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?

@amerkoleci
Copy link
Contributor Author

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?

@grokys
Copy link
Member

grokys commented Dec 9, 2014

Re: GTK3 - please start a new issue!

@tgjones
Copy link

tgjones commented Dec 11, 2014

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.

@grokys
Copy link
Member

grokys commented Dec 11, 2014

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

@danwalmsley
Copy link
Member

opengl and native program embedding is now merged.

jmacato pushed a commit that referenced this issue Feb 26, 2021
maxkatz6 pushed a commit that referenced this issue Feb 20, 2023
* NameDirectiveTransformer.cs
* Build-time diagnostics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants