Advertisement Jump to content
Sign in to follow this  
longlong9

why GDI is faster then ID3DXLine when drawing lines

This topic is 1739 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

hello everyone !  i use GDI and ID3DXLine to Draw lines in the D3Dsurface ,GDI

is not GPU accelerate,why faster then ID3DXLine? is anyone know why?

Share this post


Link to post
Share on other sites
Advertisement

You don't provide details of what you're implementing or how you're measuring relative execution times.

 

At a guess, I'd say you're using GDI to do a lot less than the equivalent ID3DXLine is capable of. ID3DXLine provides more flexibility in line drawing (storage for line lists, application of transforms, perspective stippling, etc.). It's use can be more than just drawing 2D lines on the surface. That capability comes with the price of execution time to access parameters and manipulate data that (it appears) you don't need.

 

More succinctly, you may be using a hydraulic press when all you need is a nutcracker. smile.png

Share this post


Link to post
Share on other sites

GDI or at least GDI+ is really fast, I would assume hardware accelerated by default since at least Vista. Apparently it depends on how complicated stuff you try to do with it, but basic stuff at least. I did some experimenting 2-3 years ago with trying to replace some rectangle and line drawing from GDI+ to Direct3D9 (had to support XP) using SlimDX. Using all combinations of vertex buffers, index buffers, caching, batching and god knows what, I managed to gain like 2 fps compared to just drawing each of those primitives with one draw call each, even when using anti aliasing on the GDI+ side and not on the D3D side. GDI+ was just way better att handling the particular workload I was throwing at them which primarily consisted of lines and single-colored rectangles.

Share this post


Link to post
Share on other sites

The directx line is very dependant on states (depth buffer, alpha, texturing, lighting, culling, etc..).

Did you properly disable all the states before you started using the line interface?

Share this post


Link to post
Share on other sites

Now don't quote me on that, but I believe that Humus said something like "consumer level GPUs suck at line drawing". This + poor depth behavior are the reasons debugging wireframe mode has such a low FPS.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!