I just use a triangle with 3 vertices and texture coordinates. At frame t, the first vertex information is (x1, y1, z1) + (u1, v1), if I move it to the right 1 unit ( x1' = x1 + 1 ), so how can I recompute the texture coordinate?. Anybody helps me, please?
Compute the texture coordinate based on object movement
Started by steven166, Apr 16 2012 10:08 PM
4 replies to this topic
Sponsor:
#4 Members - Reputation: 1132
Posted 17 April 2012 - 04:12 AM
I don't understand the exact problem although what you are after is totally doable.
Since you update your positions as you have showed, you'll just need to establish a relation between the texture coordinates and the positions. With the information you have provided, it isn't possible to deduce the relation you want to accomplish between the positions and texture coordinates.
Also, you haven't indicated if this is a technical problem such as "I don't know how to update the vertex buffer" or "I don't know how to calculate texture coordinates in vertex shader".
Otherwise, since you add a value to your vertex positions, can't you just add some value to your texture coordinates? Perhaps you could show a piece of code which handles the moving part?
Best regards!
Since you update your positions as you have showed, you'll just need to establish a relation between the texture coordinates and the positions. With the information you have provided, it isn't possible to deduce the relation you want to accomplish between the positions and texture coordinates.
Also, you haven't indicated if this is a technical problem such as "I don't know how to update the vertex buffer" or "I don't know how to calculate texture coordinates in vertex shader".
Otherwise, since you add a value to your vertex positions, can't you just add some value to your texture coordinates? Perhaps you could show a piece of code which handles the moving part?
Best regards!






