tags:

views:

126

answers:

2

I've managed to load a texture with TextureLoader.LoadFromFile(), and provided it with Color.Black.ToArgb() for it's colorkey.

Unfortunately, when I render it, using Device.DrawUserPrimitives, I'm still seeing black.

Am I missing some code to enable the use of the ColorKey?


Needed to set some renderstate on the Device:

Device.RenderState.AlphaBlendEnable = true;
Device.RenderState.SourceBlend = Blend.SourceAlpha;
Device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
+1  A: 

I'm not certain which but I think you need to enable the render state(s) AlphaBlendEnable and/or AlphaTestEnable. You might also have to set the blend modes.

Kath
+1  A: 

By the way, you're using Managed DirectX, which has long been discontinued. You should consider switching to XNA or SlimDX.

Promit