Skip to main content
gamedev.net
🔒 Locked

GL_LINES performance

Started by Mantear 0 replies 2.3k views
Original Post
Mantear
Mantear
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]
Jackis
Jackis
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 )))

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.