byte() image to directdraw

Started by
0 comments, last by Aardvajk 15 years, 1 month ago
Hello, Im a newbie with directx and im doing a project in which i get a byte() image from a camera and i have to paint it. Until now i do it with GDI but the use of CPU is too high so i think if i program it with directDraw it would be better. I read a lot of examples but all of them work with a bmp file. As i said i need a byte(). Can Could anyone give me an example? Which steps do i need to do? Thanks in advance.
Advertisement
You could look into IDirectDrawSurface::Lock(), which would allow you to manually copy the image data onto a surface. I'm not aware of any other ways to render user-data with DDraw.

However, there is little value in using DirectDraw now - the library is deprecated, hardware support is non-existant and it was a pretty messy API compared to Direct3D from DX8 onwards.

Direct3D is a lot easier to set up and use, IDirect3DTexture9 has equivalent Lock() and Unlock() methods and you will probably get better performance on modern cards, even when just using D3D for 2D graphics.

Plus you get loads of extras in hardware like rotation, scaling and alpha-blending. Support for the first two for DDraw in hardware was patchy to say the least and hardware support for alpha blending with DDraw never happened as far as I know.

Good article here on GDNet for getting started using D3D for 2D graphics. Once you've got your head round the preliminaries, I promise you will never look back. [smile]

This topic is closed to new replies.

Advertisement