Question regarding glUniform; problem from the arcsynthesis tutorial.

I’m stuck on a fairly easy problem and was hoping someone could point me in the right direction.

Problem: With vertCalcOffset.cpp, change it so that it draws two triangles moving in a circle, with one a half loopDuration ahead of the other. Simply change the uniforms after the glDrawArrays call and then make the glDrawArrays call again. Add half of the loop duration to the time before setting it the second time.

Relevant code:

void display()
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);


	glUniform1f(elapsedTimeUniform, glutGet(GLUT_ELAPSED_TIME) / 1000.0f);

	glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject);
	glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);

	glDrawArrays(GL_TRIANGLES, 0, 3);



I can render two triangles on top of each other by calling glUniform1f again after the first glDrawArrays call, then calling glDrawArrays again, but the only thing I can seem to do is change the speed of the second triangle. How exactly do I “add” half loop duration to one? I feel like this should be really simple and the solution is right under my nose. Thanks.

SOLVED: Nevermind, figured it out. It wasn’t hitting me why glutGet was being divided by 1000 (because it returns time in milliseconds), once I realized what was happening it was trivial: glUniform1f(elapsedTimeUniform, (glutGet(GLUT_ELAPSED_TIME) + 2500.0f) / 1000.0f);