How do I draw a Line entity that would be shown above all other entities?

The proposed solution is not natively supported and may not work in all scenarios and versions.

You can try to use the following class, and add the entity that you want to be on top after all the others.

class MyLineOnTop : Line
    public MyLineOnTop(Line another) : base(another)

    protected override void Draw(DrawParams data)
        // DepthTestAlways means that the depth testing (of the Z-buffer) when drawing the geometry always succeeds, 
        // so the last entity drawn goes over the previous geometries, regardless of its actual depth in the Z-buffer.



In this way, the line will be drawn over all the entities added before it in the model.Entities collection.


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


1 comment
  • Hi,

    I would like to show a Text always on top of other elements.

    How do I do this if I am using WPF/Direct3D?




Please sign in to leave a comment.