Advertisement Jump to content
Sign in to follow this  

GL_LINES performance

This topic is 4882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Which would be faster to draw a grid: draw a bunch of lines, or draw a bunch of quads in 'line mode'? I think I read somewhere in this forum that lines were actually drawn using triangles, and/or that the pipeline is simply not optimized to draw lines. I have an interest in this since I use grids as a frame of reference in my program, and heavily use lines to draw my GUI. Would it be better to use 'line mode' quads where possible? EDIT: btw, yes, I am using GL_LINE_STRIPS. [Edited by - Mantear on September 6, 2005 2:53:24 PM]

Share this post

Link to post
Share on other sites
For the first view, it is the same, except one thing: when you define quad, you define only 4 points, so, GL does only 4 transformation cycles.
When you draw the same linearized quad with GL_LINES, you need to specify 4*2=8 vertices.
Sure, you may use GL_LINES_STRIP, though, it would be the same.

I know, that graphics hardware works only with triangles, so, each line is the same "degenerated" triangle. So it doesn't matter, how do they being got.

And the one thing: when I draw my whole scene with skydome, sea, terrain and objects with GL_FRONT_AND_BACK - GL_LINE mode, I got less FPS, then in GL_FILL mode. Strange thing (sea fragment shader is pretty hard and cute, and in lines mode less pixels are handled), but I hope, this is because of GL on driver-API level make from each triangle 3 degenerated ones.
So, I think, that if you predefine lines and you are drawing lines, not triangles, that would be faster due to lack of driver API work.

I hope, I helped you ))) Sorry for my dumby english )))

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!