DirectX

  • Thread starter Thread starter Alun Harford
  • Start date Start date
A

Alun Harford

I'm trying to learn to use DirectX in C#, but all of the examples I've found
so far are pretty unstable (crash when minimized, crash when the window is
resized so its height is 0 pixels, crash on ctrl+alt+del, etc)

Does anybody know of a tutorial out there that handles the exceptions
correctly?

Can anybody recommend a good book on the topic?

Alun Harford
 
Hi Alun,

Your description of the exceptions is not very helpful. "crash" doesn't mean
much of anything. Good movie though! ;-)

Do you have the DirectX SDK? If not, you can get it for free from:
http://msdn.microsoft.com/directx/sdk/

All of the samples and tutorials in it work quite well.

But if you already have it, and are experiencing problems, it could also be
due to your hardware. Are you sure it's up to snuff? Have you run the
DirectX diagnostic tools in Control Panel?

Again, if you could be more specific about the exceptions, I could be more
sure of an answer.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A brute awe as you,
a Metallic hag entity, eat us.
 
Kevin Spencer said:
Hi Alun,

Your description of the exceptions is not very helpful. "crash" doesn't mean
much of anything. Good movie though! ;-)

Do you have the DirectX SDK? If not, you can get it for free from:
http://msdn.microsoft.com/directx/sdk/

All of the samples and tutorials in it work quite well.


Yes, sorry. That was quite silly of me.
If I try to run, for example, Tutorial 1 from the SDK - I can compile it
fine, and run it and it all seems okay.
Now if I hit ctrl+alt+del, and then come back from that dialog, I see that
my code has thrown a Microsoft.DirectX.Direct3D.DeviceLostException

Another example is if I resize the window so that its height is zero pixels.
Then it'll throw a Microsoft.DirectX.Direct3D.DriverInternalErrorException

My guess is that I'm supposed to catch these exceptions, and more, but I've
not found an example of how to do it or any information on what gets thrown
when, and how I'm expected to deal with them.

Alun Harford
 
Hi Alun,

The DeviceLostException occurs because the window has lost focus. There is a
framework in the SDK that has handlers for all of these sorts of events. The
tutorials don't generally include that sort of handling, in order to be as
simple as possible.

If you have Visual Studio.Net, the SDK should also install templates into
Visual Studio that create DirectX projects which include these handlers.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A brute awe as you,
a Metallic hag entity, eat us.
 
Back
Top