Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out how to draw good looking lines using XNA on the WP7 platform. By good looking I mean something not skinny and flat that a simple primitive gives you. A nice gradient, or texture or something applied.

It would be pretty easy if the lines were all straight, but I need to be able to make 45* and 90* turns.

Has anyone else tried doing this? I have found ways to do it, but they all require custom shaders which the platform doesn't support. Like this one for example

share|improve this question
up vote 2 down vote accepted

What the vertex shader for the round-line library that you linked does is simply take your two positions and use those to transform a pre-calculated outline of a line (including appropriate stretching).

You could do simply do the same transformations on the CPU, using DrawUserPrimitives or a DynamicVertexBuffer to draw them via BasicEffect.

You could then also calculate appropriate texture-coordinates on the CPU, to apply a texture of your choice (or use vertex colours for a gradient, and so on).

For a small number of lines, this should be perfectly acceptable, performance-wise.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.