entity's picture

OpentTK/WPF integration

Hello,

how can I host a glControl in a WPF application? I did not find any hint in the documentation :(

Thanks for your help,
entity


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

You have to use a WindowsFormsHost to host a GLControl.

There are no plans to provide native WPF support, because:

  1. This technology is not cross-platform.
  2. It may not be technically possible. WPF relies on Direct3D and it is highly improbable that you can mix D3D and OpenGL on a single control.

Edit: why use OpenGL if you are relying on WPF? Why not use DirectX directly?

entity's picture

> why use OpenGL if you are relying on WPF? Why not use DirectX directly?

I've not yet decided to do this. I'm just in an exploration phase, trying out some libraries and technologies for a scientific visualisation project.
The next lib I will try is SlimDX, which seems to be a proper substitute for managed DX, which is not going to be further developed.

the Fiddler's picture

Sounds interesting.

OpenGL has the advantage of inherent support for quad buffer stereo and cross-platform compatibility, both of which can be important for scientific visualizations (and that's why I went with OpenTK for my last project, a VR platform driven by a BCI).

On the other hand, DX has a cleaner API and its drivers tend to be more stable. Depending on the kind of visualization, this can be a good tradeoff.