I make a new project in Monogame with DirectX, run this example code and AntiAliasing does not enable. If I make an OpenGL project it enables correctly. Why is this happening ? How can i fix this ?
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace GameName1 {
public class Game1 : Game {
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D texture;
public Game1() : base() {
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 450;
graphics.PreferredBackBufferHeight = 800;
graphics.PreferMultiSampling = true;
Content.RootDirectory = "Content";
}
protected override void LoadContent() {
spriteBatch = new SpriteBatch(GraphicsDevice);
texture = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
texture.SetData<Color>(new Color[] { Color.White });
}
protected override void Draw(GameTime gameTime) {
GraphicsDevice.Clear(Color.Black);
Matrix skew = Matrix.Identity;
skew.M12 = (float)Math.Tan((double)Math.PI / 16);
spriteBatch.Begin(SpriteSortMode.Texture, null, null, null, null, null,
skew * Matrix.CreateTranslation(200, 200, 0));
spriteBatch.Draw(texture, new Vector2(200, -200),
new Rectangle(200, 200, 20, 500), Color.White,
(float)Math.PI / 8, Vector2.Zero, 4f, SpriteEffects.None, 0);
spriteBatch.End();
}
}
}
DirectX (AntiAliasing doesn’t work):
OpenGL (AntiAliasing works):
Why is Anti aliasing not enabling correctly in DirectX but it does on OpenGL ? You can copy and paste this code and see for yourself, the texture is made programmatically, there is no images.
Edit: I also can’t get it to work on android either