Sign in to follow this  
Mantear

GL_LINES performance

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

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

Sign in to follow this