仅修改特定元素类型的VBO缓冲区数据? [英] Modifying only a specific element type of VBO buffer data?

查看:420
本文介绍了仅修改特定元素类型的VBO缓冲区数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我有我的VBO使用单缓冲器,它有顶点,texcoord和颜色的元素。



现在,可以有效地只更新texcoords没有更新顶点/颜色?

解决方案

您可以将VBO的特定范围映射到用户内存中 glMapBufferRange 。当然,如果顶点,颜色和texcoord数据是交错的,它将等效于

如果您的VBO是:

  [XYZ XYZ XYZ XYZ RGBA RGBA RGBA RGBA TxTy TxTy TxTy TxTy] 

您只能通过映射缓冲区的最后部分( [TxTy TxTy TxTy TxTy] )来上传纹理坐标更新它。您也可以使用 glBufferSubData 执行此操作。



但如果您使用交错数据:

  [XYZ RGBA TxTy XYZ RGBA TxTy XYZ RGBA TxTy XYZ RGBA TxTy] 

那么你不能更新缓冲区的一部分。


I have my VBO using single buffer at the moment, it has vertex, texcoord and color elements.

Now, is it possible to update efficiently only the texcoords without updating the vertex/color as well? It should be the same efficiency as having separate buffers updated.

解决方案

You can map a specific range of your VBO into user memory using glMapBufferRange. Of course, if your vertex, color and texcoord data are interleaved, it will be equivalent to a glMapBuffer.

EDIT:

If your VBO is:

[XYZ XYZ XYZ XYZ RGBA RGBA RGBA RGBA TxTy TxTy TxTy TxTy]

You can upload only the texture coordinates by mapping the last part of the buffer ([TxTy TxTy TxTy TxTy]) and update it. You can also use glBufferSubData to do that. It would be faster to update that buffer than the full one.

But if you use interleaved data:

[XYZ RGBA TxTy XYZ RGBA TxTy XYZ RGBA TxTy XYZ RGBA TxTy]

Then you cannot update part of the buffer.

这篇关于仅修改特定元素类型的VBO缓冲区数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆