WPF 中的 OpenGL 与 Viewport3D 控件
WPF 中的 Viewport3D 控件可以与 OpenGL 一起使用吗?
Can Viewport3D control in WPF work with OpenGL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
WPF 中的 Viewport3D 控件可以与 OpenGL 一起使用吗?
Can Viewport3D control in WPF work with OpenGL?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
WPF 是 Viewport3D 无法做到的(有很多事情它无法做到),整个 WPF 都是基于 DirectX 的。这也意味着 DirectX 在 WPF 中通常得到更好的支持。
但是,您可以使用 OpenTK 的 WinForms 视口并使用 WinFormsHost 将其放入您的应用程序中。 OpenTK 是一个非常好的 OpenGL .Net 包装器。
但是,您将无法使用 XAML、绑定和其他 WPF 特定的内容。您必须从代码中手动执行 OpenGL 调用。互操作所做的就是将视口放置在您的应用程序中,并允许您对其进行 .Net 调用。
您可能还想看看此项目。
The WPF's something Viewport3D can't do (there are lots of thing it can't do), whole WPF is DirectX based. This also means DirectX is generally much better supported in WPF.
However you can use OpenTK's WinForms viewport and use WinFormsHost to put it in your application. OpenTK is a very nice .Net wrapper for OpenGL.
However you will not be able to use XAML, bindings and other WPF-specific stuff. You will have to do the OpenGL calls manually from code. All the interop does is that is places the viewport in your application and lets you do .Net calls on it.
You may also want to have a look at this project.
从某种意义上说,它不能将 3D 内容从 OpenGL 无缝合并到 Viewport3D(通过正确的 Z 测试等)。
It cannot, in the sense that you can merge 3D content from OpenGL to Viewport3D seemlessly (with correct Z testing and all).