Index Buffer Object and UV Coordinates don't play nice

我与影子孤独终老i 提交于 2019-12-02 09:27:44

The index applies to vertex data and texture data and attributes. There is no way around this. For example in a simple 4 quad array, it can work like below.

var backgroundObj = [ -1,-1, -1, 1,-1,-1, 1,1,-1, -1,1,-1 ];

var backgroundObjTexCoords = [ 0.000000, 0.000000, 1.000000, 0.000000,
1.000000, 1.000000, 0.000000, 1.000000 ];

var backgroundObjIndices = [ 0,1,2, 0,2,3 ];

EDIT1:

,

If you take the opposite flow as in above image, the triangles will follow the order 012, 213, 234, etc. You need to generate vertices this way even if doing manually.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!