Jump to content
  • Advertisement
Sign in to follow this  
techmonkey4u

unable to set mesh.sphere color

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

Here's what I'm doing:
Mesh particle;
particle = Mesh.Sphere(device, 2f, 10, 10);

Material currentMaterial = new Material();

currentMaterial.AmbientColor = new ColorValue(1f, 1f, 1f, 1f);
currentMaterial.DiffuseColor = new ColorValue(1f, 1f, 1f, 1f);                
currentMaterial.SpecularColor = new ColorValue(1f, 1f, 1f, 1f);
currentMaterial.EmissiveColor = new ColorValue(1f, 1f, 1f, 1f);                                 
currentMaterial.SpecularSharpness = 100;

device.Material = currentMaterial;
particle.DrawSubset(0);             



so you'd think my sphere would show up white, yes? no, it shows up as magenta.. of all colors. No matter what I put as the colors, it's always magenta. Would any of my device.RenderState options cause this? I'm using the April 2006 SDK.

Share this post


Link to post
Share on other sites
Advertisement
What's your lighting set up? If there's only magenta light, the sphere will show up as magenta, even if its color is white.

Share this post


Link to post
Share on other sites
I figured out one problem: I didn't turn off texture mapping from the previously rendered object before rendering the mesh.

But now the sphere is just white and I can't change the color.

[Edited by - techmonkey4u on July 5, 2006 7:40:13 PM]

Share this post


Link to post
Share on other sites
SOLVED.

I had to do this:


device.TextureState[0].ColorOperation = TextureOperation.SelectArg1;
device.TextureState[0].ColorArgument1 = TextureArgument.TFactor;
device.TextureState[0].AlphaOperation = TextureOperation.SelectArg1;
device.TextureState[0].AlphaArgument1 = TextureArgument.TFactor;
device.RenderState.TextureFactor = new ColorValue(0f, 1f, 1f, .5f).ToArgb();

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!