Archived

This topic is now archived and is closed to further replies.

fernandojorge

Why use DirectX Graphics instead of DirectDraw???

Recommended Posts

I''ve seen this question being debated over and over these forums and other places too, but I just can''t seem to understand most people''s arguments: why on earth would the DirectX Graphics API be better for 2D programming than plain old DirectDraw?? Could anyone answer me the following questions? 1. How can DirectX graphics beat in speed, direct surface writing that was allowed by DirectDraw? 2. How can it be easier to draw a 2D world thinking about all those matrices and transformations that DirectX graphics requires?? Could anyone explain this to me? Like I''m a six year old? Thanks anyway, And I''m sorry I sound a little bit revolted (I''m just frustated with all this) Fernando Jorge Silveira Filho Computer Science Department Federal University of Rio de Janeiro Rio de Janeiro, Brazil

Share this post


Link to post
Share on other sites
I cant really say whether or not DirectX Graphics is any faster or not that simple Direct Draw. If it is dont worry about it anyway because its deifinately not going to give you an extra 10 fps or anything. I can assure you though that to do normal 2D game programming with DX8, you wont need to work with matrices or transformation stages It isnt really that much more difficult than with DirectDraw.

Hope any of this helped
~Vendayan

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well,

First of all, a 2d application written with DirectX Graphics
(you mean DirectX8, right?) is based on primitives(3D objects),
and today graphic cards are designed to support 3D stuff and
less continue supporting 2D. This is the reason why 3D drawing
is faster than direct access. And remember that nearly all
graphics accelerators support alphablending, which would be very
slow in DirectDraw (except if you are an expert in assembly!!!)

Then, i''ts true that direct access to the memory is easier than
dealing with 3d primitives. Anyhow, nowadays you should get
familiar with all the 3D stuff, and matrices aren''t really that
difficult. I''m in college in Switzerland and I haven''t seen the
matrices theory yet, but I know how to use them in the context of
3d tranformations. It''s simple, efficient and there''s a lot of
documents about tranformations over the web.

Well, it''s all, you should code your 2d apps with DirectX
Graphics, it''s efficient, fast, and you can access to all
features of your graphics card. If you plan to use DirectX7, try
to combine DirectDraw and Direct3D.

Share this post


Link to post
Share on other sites
Well, you guys started to change my mind a little bit, but I''ve got to admit, I still get that feeling of "it didn''t have to be this way", but I guess that could be just my feelings about the way things change so fast... I''m not really a game programmer, and I used to do graphics programming a long time ago, back in the times of DOS where the best thing you could wish for was a direct frame buffer access graphics library. =)

I guess I''ll always miss those days... hehehe

Thanks a lot guys!

Fernando Jorge Silveira Filho
Computer Science Department
Federal University of Rio de Janeiro
Rio de Janeiro, Brazil

Share this post


Link to post
Share on other sites
If you are just talking about placing a bitmap onscreen with no special effects, they might break even. As soon as you start doing anything interesting, D3D8 will pull ahead with increasing significance.

Doing the slightly unfair comparison between D3D on a geForce3 and a specialized blitting API on a 4 year old $10K image processing card, the GF3 wins by a HUGE margin. Granted, the other card is 4 years old, but it was very specialized for 2D graphics (far faster than the 2D consumer cards of the time). The point is that doing it in 3D is definitely not slow if you talk to the hardware the way that it''s tuned for.

Share this post


Link to post
Share on other sites
A further question on this - if i were to use DX8 Direct3D functions to make my fairly simple 2D game, would it be slow on older computers without 3d cards compared to using DirectDraw to do the same thing?

Share this post


Link to post
Share on other sites
Yes, Direct3D is very slow without any 3D hardware rasterization support. Unless, you dont draw triangles and instead draw rectangles with the CopyRects function, which still won''t be as fast as DirectDraw''s Blt and BltFast functions.

Share this post


Link to post
Share on other sites
Yep, in that case Direct3D would be slower than DDraw...that''s one of the problems that arise then using D3D for 2D because people with old computers won''t be able to play your game. But now a days almost all people have a graphics card with enough 3D acceleration to meet your requierements. Remember that you dont need to render thousands of vertices, so your framerate depends mostly on the fillrate.

It''s also very easy to integrate 3D effects in you game. For example in my game the mainmenu consists of a spinning cube which has the mainmenu bitmap as texture. Then when the user selects something in the menu, the cube rotates until the selected menu becomes visible. That''s a nice thing, and it would be impossible to integrate something like that in DirectDraw.

-René

Share this post


Link to post
Share on other sites
If you are doing a simple 2D game with a broad distribution, then you may have to use DirectDraw despite its limitations. However, if you are trying to learn (about all those matrices, etc.) then it''s probably very worthwhile to invest in a 3D card. At less than $90US, some geForce2MX cards are extremely cheap and let you learn all the latest tricks. Learning DirectDraw at this point is a waste of time unless you specifically need to target pre-1999 cards.

Share this post


Link to post
Share on other sites
It also depends on the features you require, if its a simple space invaders type game, use DirectDraw, otherwise if you want to create something that compares to say a SuperNES game, use Direct3D since it supports alpha blending, rotation and scaling without loss of performance. The only problem is that it will not work on many older systems and almost all laptops since they do not have a decent 3D Accelerator, though 3D cards are getting cheaper and more powerful and popular all the time so by the time you decide to release a game, the majority of PC''s will be able to run the game.

DirectX8 supplies programmers with sprite helper functions that are capable of blitting 2D sprite using Direct3D with minimal fuss, once you get the graphical side up and running, its not all that hard.


Download my D3D-2D Sprite wrapper to see how D3DXSprite functions, otherwise u can use the actual wrapper in your own game.

  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''ve got an idea -- USE GENESIS3D! It''s opensource and you can distribute anything made with Genesis 3D for free, as long as you include their logo on everything included in your distribution

LONG LIFE GENESIS3D (www.genesis3d.com)!!!

Share this post


Link to post
Share on other sites
Another good reason that programmer often forgot is the graphic material.If you want rotating sprite and such things you may create dozen of sprite for each rotation step and this take a LOT of time to say the less. Lacking of good material is often the dead of one project.

With d3d you create ONE sprite that you can rotate, blend , scale
wich would have neaded at least 30-100 sprite to achieve the same effect in 2d.

Not speaking about particle effect lightning and other things
I program since many years and definitavely DX8 ROCK...
The Sample are clear and your learning curve will look nice after some days (saying that you aren''t a complete newbies for programming)

I donnot know anything about 3d math but in two day I have an entire sea scene with moving wave, several boat, sky dome , sun ect ect)

how many sprite for diablo recall me ? WHO can afford that alone or even 1/100?

Share this post


Link to post
Share on other sites
All the rotation in the world cant get you isometric-style 2d graphics, since each character must be drawn from several different viewing angles. However this is a moot point really since 3d seems to be replacing isometric for RTS games and the likes anyway.

Share this post


Link to post
Share on other sites