Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Drawing lines: transparency & anti-aliasing

$
0
0

@MikeLorenz wrote:

Hi everyone:

I'm working on an app that draws a lot of lines rather than using textures (like Asteroids or Battle Zone), and I'm trying to figure out two things:

  1. How to make some of the lines semi-transparent.
  2. How to control anti-aliasing.

Here's how I'm drawing my lines:

GraphicsDevice gd = ...;
using (var be = new BasicEffect(gd))
{
	be.VertexColorEnabled = true;
	Matrix mat;
	Matrix.CreateOrthographicOffCenter(0, w, h, 0, 0, 1, out mat);
	be.Projection = mat;
	foreach (EffectPass pass in be.CurrentTechnique.Passes)
	{
		pass.Apply();
		gd.DrawUserIndexedPrimitives(
			PrimitiveType.LineList,
			Vertices.ToArray(), 0, Vertices.Count,
			Indices.ToArray(), 0, NLines);
	}
}

Right now alpha is being ignored. And for AA I've done "PreferMultiSampling = true" but it looks terrible. I don't know how to specify 4x, or if there's some other method I can use.

Thanks in advance!
Mike

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles