Results 1 to 5 of 5

Thread: Report: DirectDraw in Managed DirectX9

  1. #1

    Thread Starter
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Report: DirectDraw in Managed DirectX9

    I took a look into Managed DirectX 9 with C#. I finally (after HOURS) managed to plot some lines via DirectDraw.

    I'm not asking any questions here, I'm just reporting what I observed.

    The documentation is non-existant. In order to know of what type collections that use the IEnumeration interface are you have to use:
    Code:
    if(en.MoveNext())
      Console.WriteLine(en.Current.GetType().FullNam);
    because the docs don't mention of which type the objects actually are.
    An example is the devices collection of DirectInput.

    This also means that I had many guesses and many exceptions before I found out how to correctly initialize DirectDraw.

    Then there is something I consider a bug in the Lock method. It returns a 2d byte array that represents the surface memory. This array has the same dimensions as the surface. This is nice if you are in 256-color mode. But in 16-, 24- or 32-bit modes where each pixel takes more than one byte this suddenly has the strange consequence that you can only access a part of the image!
    There is a workaround because you can replace that pointer with one of your own.

    The whole thing was awfully slow (with abot 5 fps) but that might have been my (very sloppily programmed) framework. I had to write it myself because the DX app wizard for C# doesn't work.

    Tomorrow I'm going to profile my framework and see where it eats the speed. Probably in the allocation of the surface memory every frame...

    Good job MS
    Last edited by CornedBee; Jan 16th, 2003 at 10:30 AM.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  2. #2

    Thread Starter
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Ok, I found out the speed hazard. It's the Lock call. It takes about 200-230 milliseconds when double-buffering and about 150-200 milliseconds when triple-buffering.

    I have no idea why it's so slow.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Ok, so locking is obviously a bad idea in Managed DX9.

    Blitting works nice and fast.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    hmm whats the differences?
    \m/\m/

  5. #5

    Thread Starter
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    To what? DX in C++?


    The creation of objects works differently. You don't have a DirectDraw or DirectInput or any other main object anymore. You directly create devices via their constructor. Same goes for all other objects, though you often have to pass the parent object (e.g. pass the device to the surface constructor).
    Blt has been renamed to Draw, but that's about all.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width