Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectDraw vs Direct3D

Started by gonegaming12 Dec 6, 2007 at 5:58 PM 6 replies 5.3k views
Original Post
gonegaming12
gonegaming12
In the DX9 SDK for VB.Net what would be faster, directdraw or direct3d?
Nuno1
Nuno1
DirectDraw and Direct3d are two diffrent things.

Direct3d is more for 3d space.

DirectDraw is used mostly for 2d worlds (for drawing as Direct"Draw" means) or used as a framework to created a 3d framework over directdraw.

Nuno1
Gluber2007
Gluber2007
This is an apples vs oranges question.

DirectDraw allows you to plot pixels on the screen.

Direct3D allows you to render 3D graphics ( or 2D ) based on polygon primitives/shaders etc and uses the 3D graphics card.

So they are both very different things, so your speed question depends on what you want to achieve.
Zipster
Zipster
DirectDraw is DirectX 7 and prior, so you don't get to take advantage of all the new stuff. Programmable shaders is a big one. And in retrospect, I always found DirectDraw to be a much larger PITA to work with than Direct3D.
gonegaming12
gonegaming12
ya but for drawing 2d which is faster.
Ravyne
Ravyne
In theory, DirectDraw is hardware accelerated, in practice - and my own observation - however, DirectDraw's support for hardware acceleration is spotty at best.

Most modern, consumer video cards simply don't dedicate any silicon to accelerating the kinds of 2D effects used in games, typically they will dedicate just enough silicon to accelerate 2D operations common to GUIs such as Windows.

Often times, they rely on their driver software to convert 2D acceleration commands into (theoretically) equivalent 3D operations. Theoretically, this should work just fine, but I've seen minor differences between makes and even models, where a given draw command would generate different results on different cards. There is seemingly no standardization for how the 2D behavior is effected through 3D hardware...

I'll give you an example. I was involved in a project several years ago at school which used DirectDraw for graphics. The School PCs were equipped with Geforce 3 and 4 series GPUs. We found that, by enlarging the destination rectangle by one pixel, the driver would translate the operation to a textured quad, thereby utilizing the hardware for a speed advantage. At standard size, the accelerated path was not used, presumably replaced with a software renderer internal to either DirectDraw or the driver. On my home PC's Radeon 9800, the trick we used to force the hardware path on the nVidea cards caused those graphics to be drawn at 2x scale, as its dimensions were rounded up to the next power of two.

DirectDraw itself is not to blame, nor is Direct3D, but rather this translation layer between the 2D API and the 3D hardware. In particular, effects such as rotation are notoriously ill-supported in hardware, and it's software fall-backs have been excruciatingly slow in my experience. Contrast that with a 2D-in-3D graphics engine that can spit out thousands of rotating textured quads without even breaking a sweat.

Now consider the lighting effects, depth and stencil buffers, and general programmability (shaders) that DirectDraw doesn't even have a notion of... A 3D API such as Direct3D or OpenGL is really the preferred way to go for modern 2D apps on a desktop machine.


Now, Windows CE and Windows Mobile are worth a brief digression -- The situation with DirectDraw is totally opposite as of right now. Because the power to do 3D on a small handset is only now coming into being, these devices dedicate more resources to accelerating 2D operations. Additionally, the software fall-backs are highly optimized for the platform, so they are really as fast as could be asked for when hardware acceleration is not available.
throw table_exception("(? ???)? ? ???");
Jerax
Jerax
That depends what sort of 2d you want to draw. Your question is far too vague to give a useful answer too.
Evil Steve
Evil Steve
Almost certainly Direct3D. As others have said, there's almost no hardware support for DirectDraw, meaning everything will be drawn in software. Using "fake" 3D graphics also gives you thingas like rotation, scaling and alpha for free. Doing that with DirectDraw requires using or writing a rotozoomer, which is a major PITA, and slow, and doing blitting on software to get alpha blending, which is also going to be slow.
Direct3D may even be faster for doing pixel operations (by locking surfaces), depending on what exactly you're doing.

The only reasons you'd want to use DirectDraw is if you need overlays or, you have a very fast CPU and an extremely slow or non-existant video card.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.