Archived

This topic is now archived and is closed to further replies.

Almost done, need more help with alpha blend

This topic is 5967 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

Alright, I almost figured this out. I narrowed down where the problem probably is. And I''m using old DX7.
  for (int rowcount = 0; rowcount < rows; rowcount++)
	{
		for (int columncount = 0; columncount < columns; columncount++)
		{
			//tile number

			tilenum=columncount+rowcount*columns;

			//texture coordinates

			//we must skip one pixel so colomn/row count is doubled when adding

			recSearch.left = (TileDim * columncount) + columncount;
			recSearch.top = (TileDim * rowcount) + rowcount;			
			recSearch.right = (TileDim * (columncount+1)) + columncount;
			recSearch.bottom = (TileDim * (rowcount+1)) + rowcount;
			  
This is my for my regions, which I actually don''t use in their RECT form. The image is 65x65. TileDim = 65 (height AND width of the image, and yes, it is 65x65).
  DDSD_Clear(&ddsd);
			ptiSpriteList[tilenum].lpddsSprite->Lock(NULL,&ddsd,DDLOCK_WAIT,NULL);

			//grab pitch and surface pointer

			lPitch=ddsd.lPitch/sizeof(WORD);
			pSurface=(WORD*)ddsd.lpSurface;

			//loop through pixels

			for(x=recSearch.left;x<(recSearch.left + TileDim -1);x++)
			{
				for(y=recSearch.top;y<(recSearch.top + TileDim -1);y++)
				{
					  
This is the actual alpha blending loop. I know some figure is off somewhere. But for the life of me I can''t figure out what. Oh, and the surface that is being written to is 64x64 (has to be divisable by 32). However recSearch.left (0) to recSearch.left + TileDim -1 (64) should be ok... First I tried without an alpha mask in the texture. Then it displayed almost nothing. Then I tried with an alpha mask. The program actually displayed everything BUT the transparent colour. Can anyone lend a hand? Please? --gmx

Share this post


Link to post
Share on other sites
?? Looks like you lost half your code when u posted, anyway check out the DDraw7 alpha blending tutorial within GameDev.net for the Alpha code. To clear a surface you dont have to clear each pixel manually, use LPDDSurface->Blt() and specify the COLORFILL flag (Check the SDK help and samples for usage).



  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
Sorry, I didn''t specify this - I am using DirectDraw surfaces with a Direct3D-based engine. Basically, textured triangles. Using colourfill won''t work.

And I left out the alpha blend code because I KNOW that works. I am thinking its either my region code or my loop code (not what is inside the loop, the loop itself).

--gmx

Share this post


Link to post
Share on other sites