Sign in to follow this  
cgillopez

byte() image to directdraw

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

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