开发者

OpenGL Transform Feedback got reverse-order result

开发者 https://www.devze.com 2023-04-13 05:08 出处:网络
I tried to use the transform feedback function, and I made 2 vertex shaders which only affects vertex position.

I tried to use the transform feedback function, and I made 2 vertex shaders which only affects vertex position.

The 1st one is a pass through shader, where position out= position in; The 2nd one is the modleview-projection result of vertex position, where position out= position in*mvp;

The problem is: when I lock the transform feedback buffer and read it, I found weird order of the data. My input data is an array of vec3(self-defined struct with 3 float), so the data is like x1,y1,z1; x2,y2,z2; x3,y3,z3; x4,y4,z4; x5,y5,z5; x6,y6,z6; ...

But the result I read from transform feedback buffer is: x3,y3,z3,1; x2,y2,z2,1; x1,y1,z1,1; x6,y6,z6,1; x5,y5,z5,1; x4,y4,z4,1; The order is reversed every 3 vertices, how come this happen开发者_运维技巧?! I totally got no idea why the orders of vertices were changed during the pass-through shader...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号