title: Enabling antialiasing drawing Primitives Monogame
body: <p>I'm trying to draw a triangle primitive using Monogame, and enabling AA.  However, I am getting this result- <a href="https://i.stack.imgur.com/OCbXW.png" rel="nofollow noreferrer">Jagged Triangle</a></p>
  <p>I want a triangle with smooth Anti-Aliased edges.</p>
  <p>Here is my code, where I've already enabled AA and set everything properly (maybe not though, as the lines are still extremely jagged)-</p>
  <pre><code>using Microsoft.Xna.Framework;
  using Microsoft.Xna.Framework.Graphics;
  using Microsoft.Xna.Framework.Input;
  
  namespace Game1
  {
      public class Game1 : Microsoft.Xna.Framework.Game
      {
          GraphicsDeviceManager graphics;
          SpriteBatch spriteBatch;
  
          VertexBuffer vertexBuffer;
  
          BasicEffect basicEffect;
  
          public Game1()
          {
              graphics = new GraphicsDeviceManager(this);
              Content.RootDirectory = &quot;Content&quot;;
          }
  
          /// &lt;summary&gt;
          /// Allows the game to perform any initialization it needs to before starting to run.
          /// This is where it can query for any required services and load any non-graphic
          /// related content.  Calling base.Initialize will enumerate through any components
          /// and initialize them as well.
          /// &lt;/summary&gt;
          protected override void Initialize()
          {
  
              graphics.PreferMultiSampling = true;
              graphics.GraphicsProfile = GraphicsProfile.HiDef;
  
              graphics.ApplyChanges();
  
              base.Initialize();
          }
  
          /// &lt;summary&gt;
          /// LoadContent will be called once per game and is the place to load
          /// all of your content.
          /// &lt;/summary&gt;
          protected override void LoadContent()
          {
              // Create a new SpriteBatch, which can be used to draw textures.
              spriteBatch = new SpriteBatch(GraphicsDevice);
  
              basicEffect = new BasicEffect(GraphicsDevice);
  
               VertexPositionColor[] vertices = new[]{new VertexPositionColor(new Vector3(160.0f, 200.0f, 0), Color.Red), new VertexPositionColor(new Vector3(200.0f, 140.0f, 0), Color.Green), new VertexPositionColor(new Vector3(250.0f, 200.0f, 0), Color.Blue) };
  
              vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 3, BufferUsage.WriteOnly);
              vertexBuffer.SetData&lt;VertexPositionColor&gt;(vertices);
          }
  
          /// &lt;summary&gt;
          /// UnloadContent will be called once per game and is the place to unload
          /// all content.
          /// &lt;/summary&gt;
          protected override void UnloadContent()
          {
          }
  
          /// &lt;summary&gt;
          /// Allows the game to run logic such as updating the world,
          /// checking for collisions, gathering input, and playing audio.
          /// &lt;/summary&gt;
          /// &lt;param name=&quot;gameTime&quot;&gt;Provides a snapshot of timing values.&lt;/param&gt;
          protected override void Update(GameTime gameTime)
          {
              // Allows the game to exit
              if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                  this.Exit();
  
              base.Update(gameTime);
          }
  
          /// &lt;summary&gt;
          /// This is called when the game should draw itself.
          /// &lt;/summary&gt;
          /// &lt;param name=&quot;gameTime&quot;&gt;Provides a snapshot of timing values.&lt;/param&gt;
          protected override void Draw(GameTime gameTime)
          {
              GraphicsDevice.Clear(Color.CornflowerBlue);
  
              basicEffect.World = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1); 
              basicEffect.VertexColorEnabled = true;
  
              GraphicsDevice.SetVertexBuffer(vertexBuffer);
  
              RasterizerState rasterizerState = new RasterizerState();
              rasterizerState.CullMode = CullMode.None;
              GraphicsDevice.RasterizerState = rasterizerState;
  
              foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
              {
                  pass.Apply();
                  GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 1);
              }
  
              base.Draw(gameTime);
          }
      }
  }
  </code></pre>
  <p>`</p>