难以理解 VBO 的用法
所以我正在尝试实现 VBO,但我找不到正确使用它们的良好教程或文档。我猜当某个对象需要它时你会创建一个VBO,然后当下一帧出现时它会被绘制/重绘。但我很困惑:
- 如何绘制多个 VBO?
- 如何修改 VBO?
- 我何时何地创建新的 VBO?
我真的很抱歉,我刚刚学习 OpenGL,所以请原谅!但很难找到一个既能制作一个 VBO,又能在绘制 VBO 的同时制作该 VBO 的教程。
我主要要求的是更好地理解 VBO 的工作原理、存储位置以及绘制方式。多少个 VBO 太多了?当我调用 glVertexPointer()
时,存储的 VBO 到底发生了什么?如果我尝试绘制不同类型的 VBO 怎么办? (只用三角形?)
So I'm trying to implement VBOs but I can't find a good tutorial or documentation of the proper usage of them. I'm guessing you make a VBO when some object needs it and then when the next frame comes about it's drawn/redrawn. But here is where I'm confused:
- How do I draw multiple VBOs?
- How do I modify a VBO?
- When and where do I make a new VBO?
I'm really sorry and I'm just learning OpenGL so excuse me for that! But it's hard to find a tutorial that doesn't just make one VBO, and doesn't make that VBO at the same time it's drawn.
Mainly what I'm asking for is a better understanding of how VBOs work, where they are stored, and how they are drawn. How many VBOs is too many? When I call glVertexPointer()
what exactly happens with stored VBOs? What if I'm trying to draw VBOs of different types? (just use triangles?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VBO 是数据存储,就像纹理一样。有一个名为
glBindBuffer
的函数,它绑定 VBO,以便通过glVertexAttribPointer
进行后续访问。glBufferSubData
或
每当现有的 VBO 不再满足您的需求时。要么是因为它们太小、太满,要么与您的数据类型不匹配。
VBOs are data storage, just like textures. There's a function called
glBindBuffer
which binds a VBO for subsequent access throughglVertexAttribPointer
.glBufferSubData
or
Whenever the existing VBOs no longer can satisfy your demands. Either because they're to small, full or don't match your data type.