Sign in to follow this  

DirectDraw or Direct3D?

This topic is 4033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For 2D only graphics on winCE 5.0 device, should I use DirectDraw or Direct3D as my graphics engine? After a bit of research it appears that DirectDraw has a more logical and common sense interface for 2D graphics programming, however I have heard that DD is deprecated (but it does not say this on MSDN...) Any ideas? Thank you!

Share this post


Link to post
Share on other sites
DirectDraw is no longer updated. It doesn't provide alpha blending, or alpha testing. It's support for scaling, mirroring, and rotating were minimal, and in some drivers, extremely slow. I seem to remember it not handling image format conversions for you on the fly.

I didn't like what limited DDraw exposure I had. Then again, I've heard horror stories of old D3D versions. I've only used D3D8 and up. If it supports D3D8, I'd suggest using that. It's a bit more work to get started, but will be worth the effort. If the device supports only lower versions of D3D, I can't give advice one way or the other.

Share this post


Link to post
Share on other sites
DirectDraw is deprecated for PCs, which have had 3D graphics for many years now. I don't think it's deprecated for Windows CE.

For Windows CE it could make sense to use DirectDraw, especially if you want to target devices that don't have a 3D chip. It's still a matter of using D3D only for when you need it.

Share this post


Link to post
Share on other sites
Actually, DirectDraw does use Alpha Testing in the form of a color key.

When I was using DirectDraw, one of the biggest limitations I found was that a) it didn't load and handle bitmaps for you, b) it did not support alpha blending and c) almost no hardware seems to support 2D rotation.

If you can live with these limitations, then DirectDraw should be fine.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sc4Freak
Actually, DirectDraw does use Alpha Testing in the form of a color key.

When I was using DirectDraw, one of the biggest limitations I found was that a) it didn't load and handle bitmaps for you, b) it did not support alpha blending and c) almost no hardware seems to support 2D rotation.

If you can live with these limitations, then DirectDraw should be fine.
Alpha testing has to be done in software on a lot of (most?) drivers, meaning blitting has to be done in software, which will slow things down a fair bit. D3D doesn't load bitmap files either, D3DX does, which is a utility library. DDraw doesn't have any such utility libraries unfortunately (A bit of a nitpick, I know [smile]).
I wasn't aware DDraw supported hardware scale or rotations at all...

Share this post


Link to post
Share on other sites
Is D3DX supported for WinCE or is it just only WinMobile? The MSDN doc is not clear on this?

DDraw does support Alpha blending - it has an AlphaBlt method. Right?

The only thing I need which I'm not seeing is can I load a png from disk into a surface using DDraw? This would be most helpful

Thank you, George

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You need to use D3D and the D3DXSprite object. Honestly! It's easy and it's *fast*.

Share this post


Link to post
Share on other sites
Direct3D Mobile is available on Windows Mobile 5.0 devices. Whether or not it is on your Windows CE 5.0 device is up to the OEM that has configured the OS for the device. Same thing goes for DirectDraw. DirectDraw isn't deprecated on CE, but is used mainly by applications that need direct frame buffer access (i.e. games that used GAPI), or need support for hardware overlays or page flipping (DShow). It doesn't do rotated or color-converted blits, but does have support for an alpha blit (which the desktop DDraw doesn't have).

As far as D3DX goes, D3DMX is a static lib that is available in the WM5 Smartphone/Pocket PC SDKs. It provides a small subset of the D3DX functionality (fixed/float math routines and texture loading - no D3DXSprite support). Again, whether this is available on your CE 5.0 platform would depend if the OEM rolled an SDK for their device that included this lib and associated header files.

If it were me, I'd probably use DDraw for this, unless there was hardware support for 3D rasterization, and then I'd use D3DM.

Hope that helps.



Share this post


Link to post
Share on other sites
Don,
Thank you. That makes sense.

The only thing I need which I'm not seeing with DDraw is the ability to load a png from disk into a surface. Any idea how to approach that? would i need a separate png lib? or is there a way to leverage GDI just for this function?

This would be very helpful.

Thank you again.

Share this post


Link to post
Share on other sites
I'd probably use the Imaging API, if it's available on your device. It supports PNG, JPEG, TIF, BMP, and possibly other formats. The Imaging API can load an image from a file into a DC, and from there you can either get at the raw pixel data (you'll need this if you want to deal with an alpha channel), or use GDI to blit it to your DDraw surface's DC.

Share this post


Link to post
Share on other sites

This topic is 4033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this