来自顶点的 VertexBuffer
I need to create a vertex buffer out of vertices. This tutorial in MSDN is splendid.
But this one holds good for DirectX10+. I am using DirectX9. How to accomplish the same here?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这应该可行,首先我们使用 CreateVertexBuffer() 创建 v_buffer,第一个值是它的大小,因此如果要添加更多顶点,请记住更改该数字,然后我们使用指针立方体将数据传输到缓冲区。如果你想从预先存在的数组传输数据,你也可以在锁定和解锁之间使用 memcpy() ,如下所示:
所有这些都是在没有颜色的情况下完成的,如果你想要颜色,你必须将其添加到构造函数中,也如果你想渲染,你必须创建一个 D3DVERTEXELEMENT9 并对其进行声明。
I think this should work, First we create the v_buffer using CreateVertexBuffer(), the first value is its size so remember to change that number if you're adding more vertices, and then we use the pointer cube to transfer data to the buffer. You can also use memcpy() between the lock and unlock if you want to transfer data from a pre-existing array, like this:
All of this is done without colour, if you want colour you have to add it to the constructor, also if you want to render you have to create a D3DVERTEXELEMENT9 and a declaration to it.