Jump to content
  • Advertisement
Sign in to follow this  
Estauns

My Texture Has No Color? [Unsolved =(]

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

Free Image Hosting at www.ImageShack.us Its a smiley face with a purple background (for colour keying) but the face part doesn't show up. My states are this:
			device.RenderState.Lighting = false;
			device.RenderState.AlphaBlendEnable = true;
			device.RenderState.SourceBlend = Direct3D.Blend.SourceAlpha;
			device.RenderState.DestinationBlend = Direct3D.Blend.InvSourceAlpha;
			device.RenderState.AlphaSourceBlend = Direct3D.Blend.SourceAlpha;
			device.RenderState.AlphaDestinationBlend = Direct3D.Blend.InvSourceAlpha;
texture = Direct3D.TextureLoader.FromFile(device, name, D3DX.Default, D3DX.Default, D3DX.Default, 0, Direct3D.Format.Unknown, Direct3D.Pool.Managed, Direct3D.Filter.None, Direct3D.Filter.None, Color.FromArgb(255, 255, 0, 255).ToArgb()); That's how I load the texture and its not giving me errors... but no face? [Edited by - Estauns on June 28, 2005 1:29:53 AM]

Share this post


Link to post
Share on other sites
Advertisement
Direct3D doesn't support colour keying. That's available only if you are using Direct Draw. However it does support alpha blending so what you need is a texture with transparency. In photoshop you would create a transparent background (the checkered thing) and create your face on it. Direct3D then should be able to render it properly (if you've set the flags right).

Share this post


Link to post
Share on other sites
When you load a texture with a colourKey specified, it builds the alpha channel for you, as far as I know. That's why my smiley face has no background, but I can't figure out why his face isn't there.

Heres the documentation for the colour key thing:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_m_dec_2004/directx/ref/ns/microsoft.directx.direct3d/c/textureloader/m/fromfile0.asp

Thanks for the response though, still can't figure out why he's all black. =(

Share this post


Link to post
Share on other sites
Hmm, remove these:


device.RenderState.AlphaSourceBlend = Direct3D.Blend.SourceAlpha;
device.RenderState.AlphaDestinationBlend = Direct3D.Blend.InvSourceAlpha;


and add these:


device.TextureState.ColorOperation = Direct3D.TextureOperation.Modulate;
device.TextureState.ColorArgument1 = Direct3D.TextureOperation.TextureColor;
device.TextureState.ColorArgument2 = Direct3D.TextureOperation.Diffuse;

device.TextureState.AlphaOperation = Direct3D.TextureOperation.Modulate;
device.TextureState.AlphaArgument1 = Direct3D.TextureOperation.TextureColor;
device.TextureState.AlphaArgument2 = Direct3D.TextureOperation.Diffuse;

Share this post


Link to post
Share on other sites
Quote:
Original post by Estauns
When you load a texture with a colourKey specified, it builds the alpha channel for you, as far as I know. That's why my smiley face has no background, but I can't figure out why his face isn't there.

Heres the documentation for the colour key thing:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_m_dec_2004/directx/ref/ns/microsoft.directx.direct3d/c/textureloader/m/fromfile0.asp

Thanks for the response though, still can't figure out why he's all black. =(


*cough* ahem. I stand corrected! heh heh... *hares away to the coffee machine*

Share this post


Link to post
Share on other sites
Do you specify a vertex color? Is it black? Endurion posted code to modulate texture by diffuse, which should be the default setting. You've disabled lighting, so that's not it, but if you're vertices contain a diffuse it could be the problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!