简体   繁体   中英

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. 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. I can't find any documentations or article showing how to index uv's. 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. 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).

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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