The standard way of doing this is to have some parameter change over time. Since you want to have it move sideways then adjust the translation in the x direction. For animating it, usually people set a timer and increment the translation on each tick. In the windows world this means handling the WM_TIMER message. Here is a sample timer handling routine for an MFC window :
void MyWindow::OnTimer( UINT_PTR eventId )
{
if( eventId == MyTimerId )
{
m_TranslationX += increment;
Invalidate(); }
__super::OnTimer( eventId );
}
glTranslatef( m_Translation, 0, 0 );
If you want to, you can increment m_Translation until it reaches a certain value and then decrement it for a while and this will cause the quads to move to the right and then to the left.