I’m developing a game which uses a great deal of “hand drawn” 2D rendering. That is, I draw lines, rectangles and whatnot instead of using a lot of sprites. I found a good, free 2D primitives library that does most of the heavy lifting.
It doesn’t have polygon support, though, so I found another solution. And let me tell you, the 2D primitives support for MonoGame in the wild is sorely lacking.
Back on track, it renders the primitives fine, but it they render with a “tunnel” look to them:
The triangle and square show the bizarre rendering issue. They’re supposed to be solid colors. The trapezoid is the only one that looks decent, but that’s because it’s supposed to be all black.
I suspect the issue is the effect the original developer used. He inherited from BasicEffect to create his own effect and did this in the constructor:
public StandardBasicEffect(GraphicsDevice graphicsDevice)
: base(graphicsDevice)
{
VertexColorEnabled = true;
Projection = Matrix.CreateOrthographicOffCenter(
0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, 0, 0, 1);
}
I’m guessing that Projection he specified is causing the strange rendering. I tried changing it up, but my Projection knowledge is weak sauce. Whenever I changed it, my primitives just disappear.
When rendering the polygon, he does this:
private void draw(BasicEffect effect)
{
effect.CurrentTechnique.Passes[0].Apply();
_graphicsDevice.DrawUserPrimitives<VertexPositionColor>(
PrimitiveType.TriangleList, _triangulatedVertices, 0, _vertices.Length);
}
Like I said, it works–the polygons appear in the correct place and size–but they render with a “tunnel” effect.
Anyone have any insight as to what might be going on or how to resolve it?