Original Post
I noticed that DirectDraw does not support Hardware Alpha Blending using 32bit ARGB mode. Even if it did support that, I think that animating sprites using a 32bit mode is too slow anyhow. How then, are lighting effects/fires etc created via DirectDraw? I''ve created a little snippet of code that performs AlphaBlending on a 16bit surface using the Lock and Unlock methods:
////////////////////////////////////////////////////////////
pDDSDest->Lock(rDest,&ddsd,DDLOCK_WAIT,NULL);//surface dest
pDDSSrc->Lock(rSrc, &ddsdSrc,DDLOCK_WAIT,NULL);
//get pointers to surfaces using DWORD(32bits at a time)
DWORD* pDDSColor = (DWORD*) ddsd.lpSurface;
DWORD* SrcColor = (DWORD*) ddsdSrc.lpSurface;
for(int iY = 0;iY <(int)rSrc->bottom;iY++)
{
for(int x = 0;x <(int)rSrc->right/2.0f;x++)
{
//arbitrary joining of the two DWORD pixels
*pDDSColor = (DWORD)(*pDDSColor | *SrcColor);
SrcColor++;
pDDSColor++;
}
SrcColor = (DWORD*) ((BYTE*) ddsdSrc.lpSurface + ( iY + 1 ) * ddsdSrc.lPitch );
pDDSColor = (DWORD*) ((BYTE*) ddsd.lpSurface + ( iY + 1 ) * ddsd.lPitch );
}
////////////////////////////////////////////////////////////
the only problem with this code is that its slow! first of all, if I could process each conversion using something larger than a DWORD(32bits) it can speed up the process tremendously.
a) Anyone know how to do that?
Next, is there a way to create lighting effects in DIRECTDRAW without AlphaBlends? I made a light animation sprite and blended it into the surface.
Well if you have any suggestions or can speed up my code, please reply. Thanks!
-=~''''^''''~=-.,_Wicked_,.-=~''''^''''~=-