有没有办法在 XNA 中锁定 VertexBuffers?

发布于 2024-09-12 03:31:21 字数 69 浏览 4 评论 0 原文

查看 MSDN 文档,我找不到锁定 VertexBuffer 的方法,以便我可以在设备上更改其数据。这在 XNA 中可能吗?

Looking at the MSDN documentation, I can't find a way to lock VertexBuffers so that I can change their data while on the device. Is this possible in XNA?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枯寂 2024-09-19 03:31:21

您可以使用多种选项来修改 XNA 中顶点缓冲区的内容:

MSDN 上有关于动态更新顶点的更多信息。 XNA 论坛上的此帖子也可能值得一读。

You have a number of options for modifying the contents of vertex buffers in XNA:

  • VertexBuffer has a SetData member. You can only safely use this outside of Draw in any case where you may activate Predicated Tiling (so it's good practice to simply always do it outside of Draw).

  • DynamicVertexBuffer is like VertexBuffer, but faster when settings its contents. However it is susceptible to the graphics device being lost, and this condition must be handled. Also take a look at SetDataOptions.

  • DrawUserPrimitives (and indexed version). This has the advantages of not affecting Predicated Tiling, and not causing the the command buffer to flush for small numbers of primitives.

There is more information on MSDN about Dynamically Updating Vertices. And this thread on the XNA forums may also be worth reading.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文