• 10
• 9
• 13
• 10
• 18

# Can I use DX8 / DX9 and C# ?

This topic is 3434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

We might get a chance to write a new application under C# that could use a 3D interface. However, wed 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 users standpoint, not a developers). 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 dont want the user to download anything. So, here comes the DX8. Every computer with WinXP has got DX8, so theres nothing that the user has to install. Wed miss some of the DX9 functionality, but we can make it up in ASM shaders. However, I have no idea if theres 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 on other sites
Quote:
 We might get a chance to write a new application under C# that could use a 3D interface.However, wed 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 users standpoint, not a developers).

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 dont 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 theres 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 on other sites

I dont get the issue with DX8, though. Every Windows XP has been shipped with DX8, so theres absolutely no need to package anything into installer. Ive 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 wed 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 Id rather go for something that is more easily maintainable in future.

Regarding NET 2.0 runtimes. Werent those included in some of the previous mandatory Windows updates ? The application were 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 wont 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, Id think that this is the same as with DX - you cant redistribute the DLLs, just let the installer download them, right ?

##### Share on other sites
Quote:
 Original post by joe1024Does the XNA installer require restart of the system ?

No it doesn't.

Quote:
 Original post by joe1024Also, Id think that this is the same as with DX - you cant 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.