Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

_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);

 

[/img]

 

Draw:

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!!

example.bmp

Posted

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.

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...