简体   繁体   English

Java vbo在opengl中,索引纹理坐标,这可能吗?

[英]Java vbo in opengl, indexing texture coordinates, is it possable?

该图显示了我的uv映射问题

As shown by the picture above, one vertex needs to map to two different uv coordinates. 如上图所示,一个顶点需要映射到两个不同的uv坐标。 I know that I can index verities with another buffer by binding it to GL_ELEMENT_ARRAY_BUFFER, but this binds the the uv in the same index. 我知道我可以通过将另一个缓冲区绑定到GL_ELEMENT_ARRAY_BUFFER来为Verity索引,但这会将uv绑定到相同的索引中。 I can't find any documentations or article showing how to index uv's. 我找不到任何有关如何索引uv的文档或文章。 I think that there is a way to do this, because it seems like something that people would find useful. 我认为有办法做到这一点,因为似乎人们会觉得有用。 How do I do it ? 我该怎么做 ?

Simply said, there is no way to index individual attributes of a vertex. 简而言之, 无法索引顶点的各个属性 The use of an element/index buffer applies to sharing a permutation of attributes eg position, uv. 元素/索引缓冲区的使用适用于共享属性的排列 ,例如位置,uv。 Since one of the attributes cannot be shared, neither can the other attributes. 由于其中一个属性不能共享,因此其他属性也不能共享。 A simple solution to that problem, is duplicating the required information to construct a new permuation (with a different uv-coordinate). 解决该问题的一种简单方法是复制所需的信息以构造新的置换(具有不同的uv坐标)。

Effectively what you need to have support for, are multiple element/index buffers, one for each attribute: element/index buffer for normal attributes, element/index buffer for uv attributes, element/index buffer for positional attributes. 实际上,您需要支持的是多个元素/索引缓冲区,每个属性一个:普通属性的元素/索引缓冲区,uv属性的元素/索引缓冲区,位置属性的元素/索引缓冲区。 But in the current generations of either OpenGL (3 or 4) or DirectX (11) (and presumably on a hardware level itself) this simply does not exists. 但是在任一的OpenGL(3或4)或DirectX(11)(可能在硬件水平本身)这根本存在的当前世代。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM