DirectDraw or GDI which one is faster and good to use?

Hi friends,
I got to know that DirectDraw APIs are being used for all drawing
operations and they are faster and specialized for drawing operations only.
Currently my requirement is to capture primary screen and send it to a
remote system. I have done it using GDI calls but I wanted to know can we do
the same using DirectDraw? If yes, which one will be faster and advisable? I
was reading some quick references, where I found using DirectDraw I can
compress the data as well, also DirectDraw is at the app level only (Please
correct me if I am wrong.).

Is it possible to use DirectDraw without actual
hardware(graphics accelerator)?

Any doc or link will help a lot.

Thanks in advance.

/sarbojit

Sarbojit Sarkar wrote:

I got to know that DirectDraw APIs are being used for all drawing
operations and they are faster and specialized for drawing operations
only.

That statement contains three assertions, and all of them are wrong.
DirectDraw is NOT used for all drawing operations. DirectDraw is an old
technology (circa 1994) that basically provides access to offscreen
surfaces and overlays. As an accident, it also allowed you to get a
pointer to the primary surface.

DirectDraw is now obsolete. Are you, perhaps, thinking of Direct3D?
WDDM is all about Direct3D. The fancy desktop effects in Vista and Win
7 are all thanks to Direct3D.

Currently my requirement is to capture primary screen and send it to a
remote system.

I don’t understand the incredible flurry of activity by people trying to
reinvent this particular wheel. Are you aware that there are quite
literally dozens of excellent products available today that do EXACTLY
THIS, some of them with 15 years of maturity behind them? This problem
has been solved. Time to move on.

I have done it using GDI calls but I wanted to know can we do the same
using DirectDraw? If yes, which one will be faster and advisable?

It is possible for you to use DirectDraw to get a pointer to the
“primary surface” and copy the pixels directly from the frame buffer.
In that case, you have the responsibility to understand the format of
the primary surface and convert it to the format you need. With GDI,
that’s done for you.

“Faster” is a matter of some debate. Reading from the frame buffer is
never quick, no matter who’s doing it. That’s not the important
direction, so hardware manufacturers spend no time optimizing that
direction. Plus, there’s a lot of data. A 1280x1024 screen is more
than 5 megabytes. With many graphics devices, it can take 100
milliseconds just to transfer that much.

Have you looked at the source for VNC or any of its derivatives? They
use a number of different methods for reading the screen image
(including GDI, DDraw, and mirror driver), depending on circumstances.

I was reading some quick references, where I found using DirectDraw I
can compress the data as well, also DirectDraw is at the app level
only (Please correct me if I am wrong.).

DirectDraw does not do compression. If there is to be compression,
you’ll have to do it. DirectDraw is called from applications, but it
calls into the kernel display driver to do its work.

Is it possible to use DirectDraw without actual
hardware(graphics accelerator)?

No. The user-mode DirectDraw layer is merely a thin adapter plate that
calls interfaces in the display driver. It is the display driver that
provides ALL of the functionality. Unlike most other APIs, there is no
emulation. If the display driver does not provide DirectDraw, then you
cannot use DirectDraw.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> DirectDraw is now obsolete. Are you, perhaps, thinking of Direct3D?

D3D includes DDraw as subset.

Surface management calls from D3D are DDraw.

Have you looked at the source for VNC or any of its derivatives?

…and all of them are worse then MS’s RDP :slight_smile:


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

1 Like

On Thu, Aug 19, 2010 at 11:54 PM, Maxim S. Shatskih
wrote:
>> Have you looked at the source for VNC or any of its derivatives?
>
> …and all of them are worse then MS’s RDP :slight_smile:

Are you sure about that? I have used RDP with acceptable performance
over dial-up links, while VNC was unusable with a five times faster
256kbps line. RDP has inherent higher latency then VNC, but much much
lower throughput requirements.


Aram H?v?rneanu

>> Have you looked at the source for VNC or any of its derivatives?

…and all of them are worse then MS’s RDP :slight_smile:

Are you sure about that?

Surely.

RDP works by far better then VNC-style solutions.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

2010/8/20 Maxim S. Shatskih :
> Surely.
>
> RDP works by far better then VNC-style solutions.

This is exactly what I am saying. I have misread your original post.
Gah. I read better' instead of worse.'


Aram Hăvărneanu