when is the indices of vertices determined to be used in gl_VertexID

I am trying to understand the behavior of gl_vertexID in vertex shaders. For that I am trying to render 2 squares using two glDrawArrays calls one after another. And want to apply red color to only one square using gl_VertexID in vertex as :

gl_VertexID holds the integer index i implicitly passed by DrawArrays or one of the other drawing commands defined in section 10.5.

Originally Posted by GL 4.3 section 10.5

Elements first through first + count - 1 of each enabled non-instanced array are transferred to the GL.

Practically gl_VertexID is the element ID, which means for glDrawArrays it is in the range [first, first+count-1].

Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
Technical Blog: http://www.rastergrid.com/blog/