Draw multiple LINE_LOOPs in one glDrawElements call

The game I'm working on has OpenGL (2.1) vector graphics, and I need to draw up to 1000 enemies, each of which is composed of between 4 and 100 lines.

Each enemy can be drawn as a single line loop, so one strategy for drawing would be to call glDrawElements(GL_LINE_LOOP, ...) once for each enemy. This results in too many (up to 1000) calls of glDrawElements per frame.

Another strategy would be to separate the line-loops that form each enemy into individual line segments, and call glDrawElements(GL_LINES, ...). This results in a lot of repeated vertices though, which I would like to avoid.

Is there a way to draw multiple line loops in a single call to glDrawElements (or with some other function)? I guess I would need some indicator in the vertex/element array to mark where each line loop ended.

Surely if you're using indices, you're not repeating verts?

You could also look at instancing, where you have a set of primitives being repeatedly drawn with a set of matrices being sent at lower frequency (i.e. a single call could draw 20 lines, repeated with 15 different matrices).

edit:

It occurs to me that you might be worried about the duplication of indices rather than verts. I wouldn't worry about that - that's kind of the point of indices. They allow verts to be reused without being retransformed by the GPU.

• Thanks - duplication (of either indices or vertices) was what I was worried about, but if that's the indented use of indices, I'm happy using those and plotting everything as separate lines. The other thing I was concerned about was artifacts at the vertices from plotting two separate lines rather than a GL_LINE_LOOP, since I'm using blending. For single-pixel-width lines though, this isn't an issue (at least on my hardware). – Chris Johnson Aug 17 '10 at 13:38