Advertisement Jump to content

OpenGL how to draw multiple line strips in one draw call?

Recommended Posts

I have a number of line strips that I need to draw and I was hoping I could group them all together into a single draw call in OpenGL.  Is there a way to do this?  With triangle strips, I can add degenerate triangles between each strip and have them all drawn together in one draw call.  Is there a trick to do the same thing with line strips?

Share this post

Link to post
Share on other sites

A couple random ideas:

1) If you're using indices check out glPrimitiveRestartIndex to see if that'll do it (I've only just noticed that functionality exists in GL!)

2) I remember reading/watching the presentation about Ghost Recon Wildlands and I think they clip bits of their terrain out for tunnels etc by setting a vertex position to inf or NaN (i.e. some invalid float value) - any triangle using an invalid vertex would be rejected completely. Although non-standard it apparently worked on all HW they tested; perhaps it'll work similarly for line segments? 


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!