Jump to content
  • Advertisement

Recommended Posts

Simple question. What is best practice for drawing overlay graphics in Directx 12? 

For now, all I want to do is to draw a semi-transparent rectangle in the upper left corner of my view.

Is there a shortcut, or do I need to set up more shaders, vertex buffers, constant buffers, root signatures etc. etc.? Since we are talking about DX12 I guess it's the later :/

Any small example project out there?

 

Share this post


Link to post
Share on other sites
Advertisement

You don't want to use D3D12 for that. First, to display an overlay window on the desktop is kind of graphics API independent. DirectX is only here for you to draw with GPU acceleration to a surface attached to an hwnd. How you decide to compose it over the desktop is a completely unrelated story. 

 

D3D12 is not design as a D3D11 replacement, they work together. 99% of application only need the safe, secure and relatively easy D3D11. Only 1% of apps, with crazy memory requirement and obsess with crazy high performance on heavy rendering that cannot be achieve with D3D11 have a need for it.

Share this post


Link to post
Share on other sites

Drawing overlay UI elements is would be no different that drawing any other object...A draw is a draw, ie. the API has not understanding of what you are drawing...all it sees are buffers, shaders, pipeline state etc... So yes you would have to all the setup required to render you overlay.

Edited by cgrant

Share this post


Link to post
Share on other sites
On 1/26/2018 at 6:16 PM, galop1n said:

You don't want to use D3D12 for that. First, to display an overlay window on the desktop is kind of graphics API independent. DirectX is only here for you to draw with GPU acceleration to a surface attached to an hwnd. How you decide to compose it over the desktop is a completely unrelated story. 

My first thought was naturally to draw normal System.Drawing.Graphics elements on top of the 3D rendering. This would be done right after presenting the swapchain and waiting for the GPU to catch up. Unfortunately it didn't work. Nothing gets drawn, at least not on top. If you have any method that works, please let me know. The area that I'm drawing onto is a SharpDX.Windows.Renderform (which inherits from System.Windows.Form.Form).

So I guess it's the long route of drawing more 3D polygons instead.

Share this post


Link to post
Share on other sites

System.Drawing.Graphics is GDI, which cannot interop in that way with swapchains of type DXGI_SWAP_EFFECT_FLIP_[SEQUENTIAL/DISCARD], which are required for D3D12.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!