Is DirectX obsolete?

R

raylopez99

I just downloaded the apparently free SDK for DirectX 9, all 200+ MB
of it, but as I read about WPF I wonder: is DirectX obsolete? Should
I even bother learning how to use it? After all, the end user must
have the DirectX library installed on their PC before they can use any
video playing program you write.

Does WPF even use DirectX? Or are the functions of DirectX (mostly
video and graphics stuff, possibly accelerated via software or
hardware) already 'built into' WPF/Vista?

I would like to know before I install the SDK.

Thanks,

RL

Playing a Video File

To play a video file, start by creating an instance of the Video
class. You can specify the file name in the Video constructor as in
the following C# code example, or else call the Open method with the
file name.
[C#]
using Microsoft.DirectX.AudioVideoPlayback; //not in standard VS2008
library, must download from MSFT
public class MyVideoPlayer : System.Windows.Forms.Form
{
 
J

JDeats

I just downloaded the apparently free SDK for DirectX 9, all 200+ MB
of it, but as I read about WPF I wonder: is DirectX obsolete? Should
I even bother learning how to use it? After all, the end user must
have the DirectX library installed on their PC before they can use any
video playing program you write.

Does WPF even use DirectX? Or are the functions of DirectX (mostly
video and graphics stuff, possibly accelerated via software or
hardware) already 'built into' WPF/Vista?

I would like to know before I install the SDK.

Thanks,

RL

Playing a Video File

To play a video file, start by creating an instance of the Video
class. You can specify the file name in the Video constructor as in
the following C# code example, or else call the Open method with the
file name.
[C#]
using Microsoft.DirectX.AudioVideoPlayback; //not in standard VS2008
library, must download from MSFT
public class MyVideoPlayer : System.Windows.Forms.Form
{

Absolutely not, although some applications that would have required
DirectX before can now be implemented using WPF with much less code.
They exist at different levels in the API stack. WPF (Windows
Presentation Foundation) is under the .NET 3.0 umbrella of
technologies, In the most simple (and most inpolitically correct)
terms you can think of WPF as an XML based markup language for
developing Adobe Flash like creations for Windows, that is it's a
vector based engine that you develop for using an XML markup language
(XAML). The web subset of WPF is Silverlight and it shares the same
markup language as desktop WPF (creating unification in UI
development) albeit with a reduced set of features.

WPF actually uses Direct3D surfaces for its rendering. Relative to
WPF, DirectX is a low-level API which is platform specific and tuned
for high performance graphics applications (namely games). DirectX 11
has been announced and is on it's way and Microsoft has said it will
be a core API for Windows Vista's successor "Windows 7". So DirectX
isn't going anywhere (yet) and if you want to write a high performance
3D application DirectX or OpenGL are really your only two options.
 
I

Ignacio Machin ( .NET/ C# MVP )

IMO they are different technologies and will coexist for a long time.
DirectX is the tool used for the majority of games in the windows
platform.
Does WPF even use DirectX?  Or are the functions of DirectX (mostly
video and graphics stuff, possibly accelerated via software or
hardware) already 'built into' WPF/Vista?

I do not know really, but I would bet that WPF uses DirectX. It has
no sense to create another graphic library


What you want to do though?
 
A

Alun Harford

raylopez99 said:
I just downloaded the apparently free SDK for DirectX 9, all 200+ MB
of it, but as I read about WPF I wonder: is DirectX obsolete? Should
I even bother learning how to use it? After all, the end user must
have the DirectX library installed on their PC before they can use any
video playing program you write.

DirectX 9 is included in Vista, and is so old that practially everybody
will have it installed on XP. Unfortunately, DirectX can be partially
installed and some systems don't have the managed bits.
Does WPF even use DirectX? Or are the functions of DirectX (mostly
video and graphics stuff, possibly accelerated via software or
hardware) already 'built into' WPF/Vista?

WPF uses Direct3D (the graphics bit of DirectX).

Managed DirectX is nice, but dead - Microsoft killed the development of
Managed DirectX 2 and encourages the use of XNA. I can't really comment
on XNA as I've not used it.

WPF gives you a nice abstraction over the Direct3D standard pipeline
(well... ish) with its 3D stuff. Performance is pretty good, and you can
write your own pixel shaders in .NET 3.5 SP1 (very recently released).
You can't write your own vertex shaders through. I also don't see a way
to manually manage which pool each texture are stored in.

In short, you can get better performance from Direct3D because you can
use vertex shaders and you can manually optimise what data needs to be
sent over the graphics bus (which can easily be the bottleneck in a 3D
application).
The disadvantages of Direct3D are *serious* though:
1) In Direct3D, you do a load of work and then call Device.Present(). If
you've done something wrong at any point, the only exception that is
ever thrown is DirectXExcption with a message: "Error in application",
and it will pretty much always be thrown when you call Present().
Debugging is a nightmare.
2) Direct3D is very low level. Drawing a triangle on the screen in a
robust way that won't crash when odd things happen takes hundreds of
lines of code.
3) You have to manually manage the differences between different
graphics cards (different features are avaliable on different graphics
cards).
4) Managed DirectX is no longer being actively developed (and I'm not
sure it's even supported).

Alun Harford
 
A

Alun Harford

JDeats said:
Absolutely not, although some applications that would have required
DirectX before can now be implemented using WPF with much less code.
They exist at different levels in the API stack. WPF (Windows
Presentation Foundation) is under the .NET 3.0 umbrella of
technologies, In the most simple (and most inpolitically correct)
terms you can think of WPF as an XML based markup language for
developing Adobe Flash like creations for Windows,

WPF the whole system. Xaml is simply an XML format for specifying the
parts of your application that don't change (similar to the partial
classes that the Winforms designer generates).
that is it's a
vector based engine that you develop for using an XML markup language
(XAML). The web subset of WPF is Silverlight and it shares the same
markup language as desktop WPF (creating unification in UI
development) albeit with a reduced set of features.

Unfortunately, Silverlight is not a subset of WPF.
WPF actually uses Direct3D surfaces for its rendering. Relative to
WPF, DirectX is a low-level API which is platform specific and tuned
for high performance graphics applications (namely games). DirectX 11
has been announced and is on it's way and Microsoft has said it will
be a core API for Windows Vista's successor "Windows 7". So DirectX
isn't going anywhere (yet) and if you want to write a high performance
3D application DirectX or OpenGL are really your only two options.

You can do a lot in WPF without having to go down to raw Direct3D
(particularly with support for pixel shaders in .NET 3.5 SP1). On the
other hand, if you're making an AAA game you have no real choice but
DirectX.

Alun Harford
 
J

JDeats

Managed DirectX is nice, but dead - Microsoft killed the development of
Managed DirectX 2 and encourages the use of XNA. I can't really comment
on XNA as I've not used it.

I have developed two small game applications using XNA for hobby. The
XNA API is different from DirectX, vastly simplified and taylored for
game applications, crippled in some aspects. Managed DirectX 10 would
really fill a gap if you wanted to create something such as a 3D
rendering package (mixing WinForms and Direct3D), unless signifigant
changes have been made to XNA, you could not do that six months
ago....

Also XNA was limited to Visual Studio.NET Express editions and C#,
does anyone know if this is still the case.

Unless you're building a game application, I would like into using
OpenGL with C# before going XNA
 
P

Pavel Minaev

Also XNA was limited to Visual Studio.NET Express editions and C#,
does anyone know if this is still the case.

As I understand, it was (and still is) a limitation only for the free
version of XNA, not for the full-featured commercial one.
 
J

JDeats

As I understand, it was (and still is) a limitation only for the free
version of XNA, not for the full-featured commercial one.

Interesting. Well, the current version is XNA Game Studio 2.0 (there
is no Professional/commerical version). XNA Game Studio 3.0 is
available as technical preview download. But I don't see anywhere in
the documentation where you can use XNA Game Studio with VS.NET 2008
Professional, it still appears to be limited to the free (read:
crippled and limited under license agreement) Express edition of
Visual C#, which would mean there is a gap left where support for
managed code ceased after the DirectX 9 SDK.

If Microsoft removes managed code support from DirectX, provides a
transition path from managed DirectX to XNA and then turns XNA
commerical product they effectively start charging for what was (and
should be) a free API. I'm sure they will bundle some tools with XNA
Game Studio to justify this, but I think it's sad that they are
ceasing to maintain managed DirectX support. Does anyone know of a
good article with someone in the XNA/DirectX team that explains the
reasoning behind this transition? I mean, other than Microsoft finding
another way to turn an otherwise free API into a commerical product.














..
 
R

Rob Lancaster

JDeats said:
Interesting. Well, the current version is XNA Game Studio 2.0 (there
is no Professional/commerical version). XNA Game Studio 3.0 is
available as technical preview download. But I don't see anywhere in
the documentation where you can use XNA Game Studio with VS.NET 2008
Professional, it still appears to be limited to the free (read:
crippled and limited under license agreement) Express edition of
Visual C#, which would mean there is a gap left where support for
managed code ceased after the DirectX 9 SDK.

XNA 3.0 CTP requires VS2008 Standard Edition or higher (with c# installed),
or c# 2008 Express Edition.

See here...

http://blogs.msdn.com/xna/Default.aspx?p=2

Rob
 
T

Todd Carnes

Alun Harford wrote:

[snip]
You can do a lot in WPF without having to go down to raw Direct3D
(particularly with support for pixel shaders in .NET 3.5 SP1). On the
other hand, if you're making an AAA game you have no real choice but
DirectX.


..... or OpenGL. :)
 
A

Alun Harford

Todd said:
Alun Harford wrote:

[snip]
You can do a lot in WPF without having to go down to raw Direct3D
(particularly with support for pixel shaders in .NET 3.5 SP1). On the
other hand, if you're making an AAA game you have no real choice but
DirectX.


..... or OpenGL. :)

Unfortunately, I don't think that's true any more. Driver support is
much better for DirectX; I think this will stifle innovation...

Alun Harford
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top