How do I specify line loops in glDrawArrays

I’m using glDrawArrays to draw a bunch of line loops, but how do I specify where the line loops begin and end? For example, I have a bunch of coordinates: c1, c2, c3, c4, c5, c6…

And I want line loops to close c1, c2, c3, then another line loop for c4, c5, c6.

I tried something like (note these are the JOGL bindings, so it is Java syntax):
gl.glVertexPointer(3, GL.GL_DOUBLE, 0, buff);
gl.glDrawArrays(GL.GL_LINE_LOOP, 0, count);

but I don’t know how to specify the indices of the line loops. I looked into glDrawElements, but I’m not sure if that’s correct either…

Thanks,
Jeff

glVertexPointer(3, GL_DOUBLE, 0, buff);
//Render first loop
glDrawArrays(GL_LINE_LOOP, 0, 3);

//Render second loop - c4, c5 c6
glDrawArrays(GL_LINE_LOOP, 3, 3);

Thanks!

Use DrawArragElements with GL_LINES and give indices 0,1,1,2,2,0,3,4,4,5,5,3
That’ll be more efficient with vertex caching, you really don’t want to make a dispatch call per triangle.