   [DX9] Line Drawing Performance.
  Is DirectX or Hardware bad at drawing lines?When I draw a line list I get about 700 fps less than drawing the same amount of triangles with a triangle list.
  Define bad, and define 700 FPS less than what original measurement. FPS is not a linear function:FPS Versus Frame Time;  Bad, meaning worse than drawing triangles.Also, note that these are very thin triangles. Drawing about 500px long and 3px wide. The lines are about 500px long too. Of coarse this is just at one viewing distance.Triangle List ~3200 fps.Line List ~2500 fps.   ;  As I thought. If you read the article above you will see:3,200 FPS = 0.3125 ms2,500 FPS = 0.4 msThe difference between the two is 0.0875 ms. Now to give you a little example. Let's say your game is running at 30 FPS which is equivalent to 33.3333 ms. Now let's add in the delta from above: 33.3333 ms + 0.0875 ms = 33.4208 ms. Convert that back to FPS and you get 29.9214 FPS. Hardly noticeable, correct?When analyzing the performance of certain graphical functions it is best to do an analysis of the milliseconds, not the frames per second. I strongly recommend you read the link I posted above. Hope this helps.   ;  I don't know if it works like that because I did another test drawing a lot more lines/triangles but the same of each...Lines ~30 FPSTriangles ~300 FPSThe difference got worse the lower the triangles fps went, it didn't stay the same.So it doesn't scale like your example.   ;  I feel like you are doing something incorrect, or your driver is screwy. Post up your example executables with source code included, and your computer configuration. Those numbers sound grossly incorrect to me, although I don't know.   ;  grasping at straws but a line could be drawn as a line... or as a very thin quad.a quad is made up of 2 triangles so that is twice the verts (potentially)also, video cards are optimized for triangle rendering, not as much for line rendering (which one is used more in games? :P)Anyhow, seems odd to me too that lines would be slower than triangles but there's 2 reasons i can think of that would explain it if it were true.   ;  I can tell you what I'm doing.I'm creating two vertex buffers. One for positions, and normals. And one for texture coordinates.I then assign the vertex values with a loop.The first post I'm only doing 2048 lines/triangles.The other test I'm doing 1 million lines/triangles.I'm using Ogre, so I don't exactly know how they treat the vertex buffer. But I'm rendering with DX9 system.Maybe a vertex buffer of 1 million is too big? I don't know.Also, I don't handle the draw calls, Ogre does, so maybe that's a problem?   ;Quote:Original post by Atrix256grasping at straws but a line could be drawn as a line... or as a very thin quad.a quad is made up of 2 triangles so that is twice the verts (potentially)also, video cards are optimized for triangle rendering, not as much for line rendering (which one is used more in games? :P)Anyhow, seems odd to me too that lines would be slower than triangles but there's 2 reasons i can think of that would explain it if it were true.Thanks for the suggestion but it wouldn't work for what I'm doing, Lines draw a pixel wide no matter how far away and angle they're viewed at from the camera but thin quads just vanish viewing them from anywhere but straight on.BTW, what are the reasons you think Lines draw worse?   ;  Sorry i didnt explain very well, my 2 thoughts of why lines might be rendering slower than triangles are...#1 - your video card could be drawing the lines as quads, not lines.  Quads are made up of 2 triangles, so really each line = 2 triangles in this case which makes sense that a line would be slower than a triangle (since it's 2 triangles!)  total guess, not sure if this actually happens on video cards.#2 - Video cards are optimized to make drawing TRIANGLES fast, not lines, because 3d games use triangles, not lines.  Because of this, the hardware to draw a line could be slower (possibly because of #1).  IE lines are drawn slower because they are used so rarely in comparison to triangles.Both are random guesses but ::shrug:: all i can think of for as to why lines could be slower.   