Advertisement Jump to content
Sign in to follow this  

Help with colors...

This topic is 4584 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.Transform.World = Matrix.Translation(0, 0, 20.0f);

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

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
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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!