Jump to content
  • Advertisement
Sign in to follow this  
Demosthenes

Help with colors...

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

I'm using the following code to render a sphere and a string (whose vertices are stored in the rope buffer variable):
public void Render()
{
  device.Clear(ClearFlags.Target, Color.Bisque, 1.0F, 0);
  device.BeginScene();

  device.Transform.World = Matrix.Translation(0, 0, 20.0f);

  device.SetStreamSource(0, ropeBuffer, 0);
  device.DrawPrimitives(PrimitiveType.LineStrip, 0, ROPE_SEGMENTS);

  sphereMesh.DrawSubset(0);
  
  device.EndScene();
  device.Present();
}
The problem is, the string is supposed to be black and the sphere white, but the string is drawn white too. When I don't draw the sphere the string is black. I set the color for each of the rope's vertices when creating the buffer. What am I doing wrong?

Share this post


Link to post
Share on other sites
Advertisement
Should the string black or white?

Anyway the problem is that you don’t set the vertex buffer format before you call DrawPrimitive. The DrawSubset Call will do this internal and as the device hold the last setting it will used the next time you draw the string.

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!