Immediate mode rendering in WPF

Refers to Eyeshot 10.0.991 and greater.

im.png


Many of you discovered that the Eyeshot native WPF control is not as fast as the Windows Forms one. Basically we all need to blame Microsoft and their D3DImage WPF control implementation. The main reason behind this issue, is the number of additional passes that D3DImage control needs to do to allow composition with the rest of the WPF elements.

A more technical discussion can be found on threads below:

 

Today, we can offer a workaround to push WPF control frame rate to the limit: Immediate Mode rendering. It can be controlled using the following property (available only in Eyeshot WPF control):

ViewportLayout.Renderer = rendererType.OpenGL;

or

ViewportLayout.Renderer = rendererType.Direct3D;

Clearly, with WPF immediate mode, you will not be able to combine (overlap or blend) the Eyeshot control with any other WPF control of your application.

 

Current Limitations

  • Drag & drop
  • Custom mouse cursors
  • GridSplitter (see CopyAndPaste sample)

 

Code Fixes

Here following some tricks to make your code work also with the Immediate mode rendering.

Replace

RenderContextUtility.ConvertPoint(e.GetPosition(viewportLayout))

with

RenderContextUtility.ConvertPoint(viewportLayout.GetMousePosition(e))

 

Replace

if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 2)

with

if (e.ChangedButton == System.Windows.Input.MouseButton.Left && viewportLayout.GetMouseClicks(e) == 2)

 

Replace

viewportLayout.Focus()

with

viewportLayout.SetFocus()
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.