Sign in to follow this  
joe1024

Can I use DX8 / DX9 and C# ?

Recommended Posts

joe1024    100
We might get a chance to write a new application under C# that could use a 3D interface. However, we`d like to avoid users to install anything at all, if possible. I looked, and it seems that XNA (which would be easiest to use for rapid development/prototyping) runtime is only 2 MB. But that requires the user to have a NET 2.0, which seems as an overkill (from user`s standpoint, not a developer`s). So, we can scale back and do it under DX9.0c. However, from what I remember seeing on forums, the user has to have the same runtime as the developer used to develop the application. So, unless we are working with the very first DX9.0c that came out, we might be in trouble, right ? We don`t want the user to download anything. So, here comes the DX8. Every computer with WinXP has got DX8, so there`s nothing that the user has to install. We`d miss some of the DX9 functionality, but we can make it up in ASM shaders. However, I have no idea if there`s some C# binding for DX8 / DX9. Is there ? Personally, I have no problem working in C++, but the new company rules avoid C++ like plague, with C# being the "right tool". So, if there was some C# binding for DX8 that would be great.

Share this post


Link to post
Share on other sites
jpetrie    13099
Quote:

We might get a chance to write a new application under C# that could use a 3D interface.

However, we`d like to avoid users to install anything at all, if possible.
I looked, and it seems that XNA (which would be easiest to use for rapid development/prototyping) runtime is only 2 MB. But that requires the user to have a NET 2.0, which seems as an overkill (from user`s standpoint, not a developer`s).

So you propose writing your application in C#, but not using the .NET 2.0 runtime? That means you'll be using the 1.1 runtime... exactly what is the difference there, besides the fact that the newer may be slightly larger and have a lot more nifty features? This is what installers are for.

Quote:

So, we can scale back and do it under DX9.0c. However, from what I remember seeing on forums, the user has to have the same runtime as the developer used to develop the application. So, unless we are working with the very first DX9.0c that came out, we might be in trouble, right ? We don`t want the user to download anything.

They have to download your installer, so package your other dependencies with said installer. They need the DirectX redistributable to run DirectX code. Period. Doesn't matter what version you elect to use, they need suitable runtime -- this is particularly important for the D3DX DLLs. You can't distribute these DLLs legally, you must distribute the redistributable installer; yet another argument for packaging all this inside your own installer.

Quote:

However, I have no idea if there`s some C# binding for DX8 / DX9. Is there ?

For DX9 you can use the (deprecated) MDX or the new, shiny SlimDX. However your users will need runtimes installed for both of these (SlimDX includes an appropriate installer for its dependencies, which will make your job much easier). You can only access D3D9 with MDX, and D3D9 and up with SlimDX. You can't talk to D3D8 with these APIs.

In short: there's no easy way to call into D3D8, and even if there was, you already have dependencies the user needs to download, so you may as well use the most modern tools you can and ship their dependencies bundled into your installer, since you have to do the latter anyway.

(Note that this isn't even confined to C#, with C++ you still need the DirectX and C++ runtimes distributed if you want to be maximally usable).

Share this post


Link to post
Share on other sites
joe1024    100
Thanks for the informative reply.

I don`t get the issue with DX8, though. Every Windows XP has been shipped with DX8, so there`s absolutely no need to package anything into installer. I`ve done that countles times already - lots of my own DX8 apps on a clean XP install and all went smooth. Of course, that was all under C++, which we`d like to avoid now, since not that many developers know it well and because most of them know C#. Although, most of my proffesional work has been under C++, my team is mostly C#, so I`d rather go for something that is more easily maintainable in future.

Regarding NET 2.0 runtimes. Weren`t those included in some of the previous mandatory Windows updates ? The application we`re about to develop is for internal corporate environment, where we could safely assume, that each PC is being updated regularly. So, then we would only have to include the package for SlimDX or XNA.

I might be wrong, but I think that XNA is better suited for rapid prototyping (mainly due to a way it can handle meshes/textures) and should be easier on developers who have absolutely no idea about 3d gfx. We won`t use much of the 3D element anyway, but if that is abstracted better than in SlimDX, that would be a huge win for us.

So, this boils down to two options:
1. Low-level DX8 under C++ (with a later maintanance nightmare laid upon us)
2. Higher-level XNA under C# (which I believe to be of a lesser maintanance issue)

Does the XNA installer require restart of the system ?
Also, I`d think that this is the same as with DX - you can`t redistribute the DLLs, just let the installer download them, right ?

Share this post


Link to post
Share on other sites
MJP    19753
Quote:
Original post by joe1024
Does the XNA installer require restart of the system ?


No it doesn't.

Quote:
Original post by joe1024
Also, I`d think that this is the same as with DX - you can`t redistribute the DLLs, just let the installer download them, right ?


Right: you have to package the redistributable in your installer and run it. You also have to package in the Visual C++ 2005 SP1 redistributable, along with the the DirectX Redistributable and the .NET 2.0 redist (unless you can guarantee the client PC has kept up on Windows Updates, or they're running Vista). Keep in mind though that the new version of XNA, which is due out very soon, has the capability to automatically produce a ClickOnce installer for your project that will handle all of this for you.

Either way I would make your decisions based on what you think is the best technology for the job, and not on what lets you avoid installing prerequisites. Making an installer that can ShellExecute a few redists is really pretty trivial, and is very much a fact of life with Windows software development.



Share this post


Link to post
Share on other sites
joe1024    100
You mean XNA 3.0 ? That would be great if it could handle installers more conveniently. I`m used to creating installers under NSIS scripts, but would love to get rid of this process.

Will the HW requirements of XNA 3.0 stay the same ? We need the app to run on any integrated Intel chipset, even if 5+ yrs old. Which means no pixel shader requirement, just the default VS 1.1.

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