Thread: DirectX 2D Frames Per Second

  1. #1
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856

    DirectX 2D Frames Per Second

    So I recently wrote a DirectX 2D engine (my first venture into game programming) and developed my first game with it (see the thread where I posted it). My question is about the FPS I get with it. It is a very simple "boardgame" type thing with very simple bitmaps for graphics. In windowed mode I get well over 100FPS (I still think it's low), but in fullscreen I max out at about 75FPS or so (my GPU is not a factor; it's new and powerful). Does this sound normal to you folks? What's the general frames per second you get out of your DX 2D games?

    Thanks.

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    I know directx 2d games go slower than people would usually think they would because of how DirectX operates. I read it a while ago but I think it's because the 2d functions still go through DirectShow, which makes it go slower than before the 2d and Direct3D functions were merged.

  3. #3
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    I had a suspicion it might have something to do with the lack of continued support of standalone DirectDraw.

    Thanks for the reply.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Actually it's probably because of V-Sync. Try turning that off and see what fps you get.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Ahh, so...

    Right, V-Sync. I should have realized... The refresh rate is about 70Hz and so with the flip only on refresh there's no way it can display a frame any sooner...

    Thank you again Mr. Wizard. I hope you took a look at what your assistance with memory mapping accomplished (the CRAM file with my game). I appreciate your wisdom. (Also, I loved your show when I was young).

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Quote Originally Posted by LuckY
    Ahh, so...

    Right, V-Sync. I should have realized... The refresh rate is about 70Hz and so with the flip only on refresh there's no way it can display a frame any sooner...

    Thank you again Mr. Wizard. I hope you took a look at what your assistance with memory mapping accomplished (the CRAM file with my game). I appreciate your wisdom. (Also, I loved your show when I was young).
    Yup it won't get any faster when you wait for vsync to flip.

    Unfortunately I never saw the end result of the file mapping stuff that you did. I'm sure it turned out quite good though! If you post a link I would be happy to look at it.

    I used to watch the show when I was a kid too, it's a shame about that guy though.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  7. #7
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Quote Originally Posted by MrWizard
    If you post a link I would be happy to look at it.

    I used to watch the show when I was a kid too, it's a shame about that guy though.
    Here's a direct link to my first game, called Blocker (please forgive the lack of description and creativity of the name).

    Why, what happened to him? I have never heard anything about him.

    Do you remember how to cut a hole in a sheet of paper big enough to walk through? Just one of the countless memories of things I loved learning with the old guy.

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Maybe if you choose to accept pm's I'll let you in on it. Otherwise I'm sure you can find out with a little searching.

    Yea, I remember the walk through the piece of paper trick, that was classic.

    I'll check out your game when I get home from work.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  9. #9
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    I had no idea that I had PMs disabled. They are enabled now, so if you get a chance I'd be glad to hear about it. I too am at work and have been searching for info but can't find out what is a shame about the fellow.

  10. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    If you are using the hardware blitter then that is the problem. It is not suited for all types of operations. I would use Direct3D and get a pointer to the back buffer. Then just draw on it how you want to. This requires one lock and one unlock per frame of animation. Thus far I've gotten very good results with this....and with a little assembly mixed in.

    To speed things up a bit...move to Direct3D and have it render your sprites as textured quads. Use the vertex format that has already been transformed because this tells Direct3D not to run your vertexes through the transformation pipeline. They will be displayed as is in screen space. With this you gain the advantage of being able to rotate your image to any angle as well as being able to filter the texture - which is not always a good idea with perfect pixel textures...filtering will cause you to lose some detail. However if you render your maps or level in 2D with assembly and/or C via a pointer and then render bitmaps and explosions and other things with hardware....you should get well over 100 frames per second with vsync off.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2D in directX
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 01-25-2009, 11:23 AM
  2. text on 2d tiles in DirectX?
    By Quantum1024 in forum Game Programming
    Replies: 4
    Last Post: 04-26-2006, 11:40 PM
  3. 2D in DirectX 9
    By maxthecat in forum Game Programming
    Replies: 12
    Last Post: 01-08-2006, 09:17 PM
  4. OpenGL DirectX 2D
    By c++.prog.newbie in forum Game Programming
    Replies: 11
    Last Post: 03-01-2005, 01:54 PM
  5. 2D Game Project with DirectX and C++
    By VMJC in forum Projects and Job Recruitment
    Replies: 4
    Last Post: 12-23-2004, 12:28 AM