DirectX

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alun Harford

    #1

    DirectX

    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


  • Kevin Spencer

    #2
    Re: DirectX

    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.


    "Alun Harford" <usenet@alunhar ford.co.uk> wrote in message
    news:dtvfce$nh9 $1@gemini.csx.c am.ac.uk...[color=blue]
    > 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
    >
    >[/color]


    Comment

    • Alun Harford

      #3
      Re: DirectX

      "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
      news:eCnWqd9OGH A.3888@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Hi Alun,
      >
      > Your description of the exceptions is not very helpful. "crash" doesn't[/color]
      mean[color=blue]
      > 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.[/color]


      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.Direc tX.Direct3D.Dev iceLostExceptio n

      Another example is if I resize the window so that its height is zero pixels.
      Then it'll throw a Microsoft.Direc tX.Direct3D.Dri verInternalErro rException

      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


      Comment

      • Kevin Spencer

        #4
        Re: DirectX

        Hi Alun,

        The DeviceLostExcep tion 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.


        "Alun Harford" <usenet@alunhar ford.co.uk> wrote in message
        news:du0496$6nv $1@gemini.csx.c am.ac.uk...[color=blue]
        > "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
        > news:eCnWqd9OGH A.3888@TK2MSFTN GP12.phx.gbl...[color=green]
        >> Hi Alun,
        >>
        >> Your description of the exceptions is not very helpful. "crash" doesn't[/color]
        > mean[color=green]
        >> 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.[/color]
        >
        >
        > 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.Direc tX.Direct3D.Dev iceLostExceptio n
        >
        > Another example is if I resize the window so that its height is zero
        > pixels.
        > Then it'll throw a Microsoft.Direc tX.Direct3D.Dri verInternalErro rException
        >
        > 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
        >
        >[/color]


        Comment

        Working...