colorkey (c#)!!!

Dark Crystal

Newcomer
Joined
Oct 1, 2003
Messages
10
hi, ervery1

how can i use colorkey for texture ?

i tried to do it by this code but it didn't work

Code:
device.RenderState.AlphaBlendEnable = true;
device.RenderState.AlphaDestinationBlend = Blend.one  ;
device.RenderState.AlphaSourceBlend = Blend.SourceAlpha  ;
device.RenderState.AlphaBlendOperation = BlendOperation.Add ;

and i tried to change the alphaDest , alphaSorc and operation but the result nothing ((just like ORG image))

can any1 help me



i know my english is bad ,, but i'll try my best

thanks in advance
 
have you loaded the texture with colorkey?
Tex1 = TextureLoader.FromFile(device, filesrc, Width, Height, 0, 0, Format.Unknown, Pool.Default, Filter.Linear, Filter.Linear, colorkey)
colorkey is an integer value for color (use .toArgb from color class)
try this

D3DRS_SRCBLEND=D3DBLEND_SRCALPHA
D3DRS_DESTBLEND = D3DBLEND_INVSRCALPHA
(is VB6 code but obviosly you can adapt it on C#)
 
hi roby,,

i load it with colorkey (.toArgb)

but whatever i but in D3DRS_SRCBLEND or DESTBLEND nothing happen ((that mean the alpahblend does't work))
:confused:
 
nono, it works

i think you did one of these wrong:
device.RenderState.AlphaBlendEnable = true;
device.RenderState.AlphaDestinationBlend = Blend.one ;
device.RenderState.AlphaSourceBlend = Blend.SourceAlpha ;
device.RenderState.AlphaBlendOperation = BlendOperation.Add ;

ill get back to you on this question when i get back to my comp with .net,
i know that one of those things above is Blend.SourceInv or something

edit: meanwhile, see if the code on this post works for you
http://www.xtremedotnettalk.com/showthread.php?threadid=82838
 
Back
Top