Alpha problem

spatuel

Newcomer
Joined
Mar 3, 2004
Messages
10
Location
London
Hi All,

Blending is a pain for me, I am trying to write a simple tile engine, the images are ok, everything looks fine, but when I draw it on Direct 3d is showing a small line between every sprite, indeed, I create a wrong coast line that goes into the previous tile and you can see the effect. I am pretty sure is something wrong with the blending, can anybody check the code or explain me how blending works? Thanks a lot.

Init:
Code:
_objDD.RenderState.CullMode = Cull.Clockwise;
_objDD.RenderState.Lighting = false;
_objDD.RenderState.AlphaBlendEnable = true;
_objDD.RenderState.SourceBlend = Blend.SourceAlpha;
_objDD.RenderState.DestinationBlend = Blend.InvSourceAlpha;
_objDD.Clear (ClearFlags.Target, Color.FromArgb (255,0,0,0).ToArgb(),0,0);



Draw:
Code:
m_MainSprite.Begin (SpriteFlags.AlphaBlend);

m_MainSprite.Draw (
     m_Map [FirstHeightTile,FirstWidthTile,0].Tile_Texture, 
     m_Map [FirstHeightTile,FirstWidthTile,0].Frame, 
     VectorNull, 
     Vector,
     Color.FromArgb(255,255,255,255).ToArgb() );

Of course I am closing and I didn't put any extra init code, my blending is showins as the attached file.

Can anybody help me please?
thanks!!
 

Attachments

You have streched the image?
If you have scaled the image the filters has started to work.
You can't draw sprite bigger or smaller than the original size. If you want't to allarge it you must draw the sprite in scale 1:1
on a surface (renderToSurface) and then use the result to show it on screen with the dimension that you want.
 
I am not stretching it, indeed my filters are Filter.None Anyway is good to know that!, thanks a lot.

I think I found the problem, I changed how the device is created, at the moment is using HAL, I have changed to Reference and works ok but is soooooooooo slow that is impossible. I have tested it on a desktop machine with a 3d accel card and works fine, is my laptop where is shown the problem,

thanks a lot!

SAlva
 
Back
Top