How to make my simple round sprite look right in XNA
Posted
by
Joshua Perina
on Game Development
See other posts from Game Development
or by Joshua Perina
Published on 2012-10-25T06:17:03Z
Indexed on
2012/10/25
11:16 UTC
Read the original article
Hit count: 263
XNA
|antialiasing
Ok, I'm very new to graphics programming (but not new to coding). I'm trying to load a simple image in XNA which I can do fine. It is a simple round circle which I made in photoshop. The problem is the edges show up rough when I draw it on the screen even with the exact size. The anti-aliasing is missing. I'm sure I'm missing something very simple:
GraphicsDevice.Clear(Color.Black);
// TODO: Add your drawing code here
spriteBatch.Begin();
spriteBatch.Draw(circle, new Rectangle(10, 10, 10, 10), Color.White);
spriteBatch.End();
Couldn't post picture because I'm a first time poster. But my smooth png circle has rough edges. So I found that if I added:
spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied);
I can get a smooth image when the image is the same size as the original png. But if I want to scale that image up or down then the rough edges return. How do I get XNA to smoothly resize my simple round image to a smaller size without getting the rough edges?
© Game Development or respective owner