Sign in to follow this  
cgishack

Is DirectX right for me ?

Recommended Posts

I am planning out a program i am interested in witting and would like to see if DirectX is what i really want. I need to draw a large 2D image that can be an infinite number of lines. Sometimes the image could be a total of 50,000 lines I did a sample in C# using GDI but it took about 15 seconds to draw a single image. I then would like to convert the drawn image to a .gif , jpg or png Can DirectX handle all this for me? Drew

Share this post


Link to post
Share on other sites
DirectX will render faster than GDI in a lot of cases, but rendering 50,000 lines will take a non-trivial amount of time even on fast PC with a modern graphics card.

I believe that the D3DX library has some functionality to save surfaces to common file formats.

However, if the only purpose of this is to create a saved image file, why does it matter if it takes 15 seconds? If you are pre-rendering images for later use, I'd use whatever language and tools are easiest rather than fastest. C# and GDI+ are a clear winner in this case.

Share this post


Link to post
Share on other sites
Even if directx were capable of handling an image that size (which I suspect is unlikely, and would likely vary depending on hardware), I doubt it would be faster than doing it with GDI. Ultimately you're still writing large amounts of pixel data to memory, something that'll be slow either way.

How are you writing to the image with GDI? Be warned that Bitmap.GetPixel and SetPixel are notoriously slow. You're better off using LockBits.

But again, what you're describing will always be slow. 15 seconds to generate an image that size doesn't terribly surprise me.

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