I’ve been looking for a good 3 hours now and previously when I wanted to draw to PDI I looked for days and eventually gave up on my concept. I am trying to get a runtime Gizmo working and have looked at the UE4 source code and there’s a render method within FWidget but is being called through 4 methods, each passing a PDI into the method but would prefer to just have the gizmo object render in its own tick.
I have had a look at FDynamicMeshBuilder and FViewElementDrawer but have tried to inherit from these and override a method that passes a FPrimitiveDrawInterface instance but nothing works.
Does anyone have example code laying around they could share of drawing to PDI?
I was asking what the context is since that affects how you can get hold of a PDI.
But yes, for the general case, you would want to create a custom component deriving from UPrimitiveCompoent, and a custom scene proxy to go with it.
I have some rather old code here you can look at. It probably wouldn’t compile with current engine versions, but the general process is essentially still the same.
So last night I finally got around to trying this out and it worked, however it was not exactly what I wanted: The elements I drew to screen were frustum culled; the moment the origin of the object the FPrimitiveSceneProxy was attached to went out of view the PDI would disappear. The elements drawn also seemed to clip through 3D geometry, my assumption is that I have to set up a material that disables depth testing? Code below: