简体   繁体   English

执行RenderTargetBitmap后,Viewport3D不更新视觉效果

[英]Viewport3D not updating visuals after performing RenderTargetBitmap

Rendering a Viewport3D with a RenderTargetBitmap.Render call seems to cause the Viewport3D to no longer update its visual content. 使用RenderTargetBitmap.Render调用渲染Viewport3D似乎导致Viewport3D不再更新其视觉内容。 The interactive actions still work though, such a hover-over and clicking. 交互式动作仍然有效,例如悬停和单击。

I've created an example in which I have a viewport which contains a button. 我创建了一个示例,其中有一个包含按钮的视口。 I then render the viewport with RenderTargetBitmap. 然后,我使用RenderTargetBitmap渲染视口。 After this render, I try to toggle the visibility of the button but the visuals of the button no longer update which is unexpected. 渲染之后,我尝试切换按钮的可见性,但是按钮的视觉效果不再更新,这是意外的。 It is however not possible to click on the button as you would expect when it is collapsed. 但是,无法单击折叠时的按钮。 Toggling back the visibility to visible allows me to click the button again so it seems that only the visuals are no longer processed correctly. 将可见性切换回可见状态后,我可以再次单击该按钮,因此似乎只有视觉效果无法正确处理。

It seems that the viewport loses track of the correct buffer it should use and keeps displaying the old version no matter what. 视口似乎无法跟踪应使用的正确缓冲区,并且无论如何都会保持显示旧版本。 I would like the viewport to just keep updating its visuals as it did before the render call, any ideas what I am missing here? 我希望视口像在渲染调用之前一样一直更新其视觉效果,我在这里缺少什么想法?

I've uploaded the demonstrator on bitbucket, the sourcefiles can be viewed here: Sourcecode 我已经在bitbucket上上传了演示程序,可以在这里查看文件: 源代码

The demonstrator is also available as a VS2010 solution: download solution 该演示程序也可作为VS2010解决方案提供: 下载解决方案

If you require any other information please let me know, I'll try to answer your questions as detailed as possible. 如果您需要任何其他信息,请告知我们,我们将尽力回答您的问题。

I was having a similar issue. 我有一个类似的问题。 After the call to RenderTargetBitmap's Render(), I noticed that, for example, any color changes applied to the visuals within the Viewport were not being displayed. 调用RenderTargetBitmap的Render()之后,我注意到,例如,未显示应用于视口中视觉效果的任何颜色更改。 As you state, the interactive actions like clicking, rotating, hover-over, etc. were still working. 如您陈述的那样,单击,旋转,悬停等交互操作仍在起作用。

Within my application the Viewport being rendered was itself sitting inside (ie a child of) a Grid. 在我的应用程序中,正在渲染的视口本身就位于网格内部(即网格的子元素)。 I found that if, after the call to RenderTargetBitmap's Render() method, I removed the Viewport from and then readded the Viewport to the Grid's 'Children' list, the visuals within the Viewport continued to update as they did before the call to Render(). 我发现如果在调用RenderTargetBitmap的Render()方法之后,我从视口中删除了视口,然后将视口重新读取到网格的“子级”列表中,则视口中的视觉效果继续像调用Render( )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM