View Full Version : How to efficiently transform and use the resulting coordinates in later iteration ope

02-28-2016, 02:12 AM
I have to draw a wheel that would be rotating and advancing through the x axis . The wheel is made up of a simple circle and 4 diameter lines. Now in each iteration the lines translated and rotated by a small degree , and the circle and center should be only translated along x-axis.

What would be the best way to achieve this in opengl? I have 2 methods in mind

1) create an initial array of vertices and line co-ordinates and then create two shaders for circle and the lines. And then in each iteration calculate the rotation and translation matrix and pass to the vertex shader this matrix and the initial vertices through uniform at each iteration.

2) calculate the transformation matrix once , and then in each iteration update the vertex array with the new coordinates ( I don't know how to return data from.vertex shader though) .

So which would be most efficient way of doing this animation and if it is 2 please explain how I can achieve this as I don't know how to get the vertex shader output of one iteration to use in the next iteration .

02-29-2016, 02:04 AM
3) just send time to your shader and compute matrix in your shaders!