DirectX 10 中的清晰单视口
我正准备开始开发一个 C++ DirectX 10 应用程序,该应用程序将包含多个“面板”来显示不同类型的信息。我在一个 RenderTargetView 上尝试多个视口取得了一些成功。但是,我找不到关于如何一次清除单个视口的明确答案。我的应用程序中的这些面板(视口)将在某些区域重叠,因此我希望能够从“下到上”绘制它们,在我移动时清除每个视口,以便下部面板中的绘图不会显示在更高的。在 DirectX 9 中,设备对象似乎有一个 Clear() 方法,该方法只能清除当前设置的视口。 DirectX 10 使用 ClearRenderTargetView(),它会清除整个绘图区域,我找不到任何其他与 DirectX 9 相同的选项。
DirectX 10 中有没有办法只清除绘图区域内的视口/矩形?有人推测唯一的方法可能是在那个空间画一个四边形。似乎另一种可能性是为每个面板都有一个单独的 RenderTargetView,但我想避免这种情况,因为它需要其他冗余资源,例如单独的深度/模板缓冲区(除非这是我的误解)。
任何帮助将不胜感激!谢谢!
I am preparing to start on a C++ DirectX 10 application that will consist of multiple "panels" to display different types of information. I have had some success experimenting with multiple viewports on one RenderTargetView. However, I cannot find a definitive answer regarding how to clear a single viewport at a time. These panels (viewports) in my application will overlap in some areas, so I would like to be able to draw them from "bottom to top", clearing each viewport as I go so the drawing from lower panels doesn't show through on the higher ones. In DirectX 9, it seems that there was a Clear() method of the device object that would clear only the currently set viewport. DirectX 10 uses ClearRenderTargetView(), which clears the entire drawing area, and I cannot find any other option that is equivalent to the way DirectX 9 did it.
Is there a way in DirectX 10 to clear only a viewport/rectangle within the drawing area? One person speculated that the only way may be to draw a quad in that space. It seems that another possibility would be to have a seprate RenderTargetView for each panel, but I would like to avoid that as it requires other redundant resources, such as a separate depth/stencil buffers (unless that is a misunderstanding on my part).
Any help will be greatly appreciated! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议每个“视口”使用一个渲染目标,并使用四边形将它们合成在一起以获得最终视图。我知道没有办法在 DX 10 中进行清除。
另外,根据文章此处,“渲染目标视图的数组可以传递到 ID3D10Device::OMSetRenderTargets,但是所有这些渲染目标视图将对应于单个深度模板视图。”
希望这有帮助。
I would recommend using one render target per "viewport", and compositing them together using quads for the final view. I know of no way to scissor a clear in DX 10.
Also, according to the article here, "An array of render-target views may be passed into ID3D10Device::OMSetRenderTargets, however all of those render-target views will correspond to a single depth stencil view."
Hope this helps.
您能否仅创建一个着色器以及适当的混合状态设置和方形网格(或其他形状的网格)并使用它来清除要清除的区域?我没有尝试过,但我认为这是可以做到的。
Could you not just create a shader together with the appropriate blendstate settings and a square mesh (or other shape of mesh) and use it to clear the area where you want to clear? I haven't tried this but I think it can be done.