I'm reading a book about openGL and I got to a part that after I draw a triangle the author taught the reader to make the triangle move in a circular movment

this is the code he was using to calculate the offset for the new x and y of the vertices

Code :void ComputePositionOffsets(float &fXOffset, float &fYOffset) { const float fLoopDuration = 5.0f; const float fScale = 3.14159f * 2.0f / fLoopDuration; float fElapsedTime = glutGet(GLUT_ELAPSED_TIME) / 1000.0f; float fCurrTimeThroughLoop = fmodf(fElapsedTime, fLoopDuration); fXOffset = cosf(fCurrTimeThroughLoop * fScale) * 0.5f; fYOffset = sinf(fCurrTimeThroughLoop * fScale) * 0.5f; }

java version :

Code :final float fLoopDuration = 5.0f; final float fScale = 3.14159f * 2.0f / fLoopDuration; float fElapsedTime = System.nanoTime() / 1000.0f; float fCurrTimeThroughLoop = fmodf(fElapsedTime, fLoopDuration); fXOffset = cosf(fCurrTimeThroughLoop * fScale) * 0.5f; fYOffset = sinf(fCurrTimeThroughLoop * fScale) * 0.5f;

the fXOffset and the fYOffset are being added to the vbo using glBufferSubData and after they're being sent again to the vertex shader

now I dont understand how it makes the triangle move in a circular motion

I hope someone could make things a bit more clear to me