How can I get the DirectX render device?

Hello there,

I am looking to intergrate this GUI framework (GitHub - garrynewman/GWEN: Abandoned: GWEN - GUI Without Extravagant Nonsense.) with Unreal Engine.
In order to set it up though I need to use the DirectX render device to initialize the actual GUI renderer.

Is there any way I can get this from the engine itself?

There is always a way if you have source code to the engine; ), but this would not be easy.

Take a look on the:


// Accessors.
	ID3D11Device* GetDevice() const
		return Direct3DDevice;

This is your device, as you see this is separated module from the engine code and implementation is private, you can’t call any of the functions of D3D11RHI directly from the engine.

You have to implement your own RHI method(this would be exposed to the engine code) and obtain it with void* to the ID3D11Device.


This is the easy part.

Hard part is to synchronize rendering from the GUI framework with engine:)

It would be better to integrate this GUI framework with the engine as a plugin and use RHI methods than stealing ID3D11Device from the engine:)

Or make a hook in D3D11 dlls and render GUI as overlay :wink:

Hope it will help you ;), good luck.

Thanks! I’ll take a look at using the RHI methods!