Sign in to follow this  
vlad2048

Why my sprites don't display correctly ?

Recommended Posts

Here, http://img269.imageshack.us/img269/3249/screenywwu.jpg On the left is the simple sprite I've drawn in photoshop and on the right is the sprite rendered by directx. Notice they're both 5x5 pixels so I don't think any min/mag filters are being used. Why is my drawn sprite so different ? It's not even symmetric anymore That's the code I use CustomVertex.TransformedTextured[] vertices = new CustomVertex.TransformedTextured[4]; vertices[0].Position = new Vector4(x, y, 0f, 1f); vertices[0].Tu = 0f; vertices[0].Tv = 0f; vertices[1].Position = new Vector4(x, y + h, 0f, 1f); vertices[1].Tu = 0f; vertices[1].Tv = 1f; vertices[2].Position = new Vector4(x + w, y, 0f, 1f); vertices[2].Tu = 1f; vertices[2].Tv = 0f; vertices[3].Position = new Vector4(x + w, y + h, 0f, 1f); vertices[3].Tu = 1f; vertices[3].Tv = 1f; D.SetTexture(0, tex); D.VertexFormat = CustomVertex.TransformedTextured.Format; D.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, vertices);

Share this post


Link to post
Share on other sites
Thanks ! It's better. Now it's symmetric
But it's still not the same image as my drawing:
http://img268.imageshack.us/img268/2088/screeny2h.jpg

What do you think is wrong ?

Share this post


Link to post
Share on other sites
Seems like bilinear filtering or something.. try using point sampling and disable mipmaps. Are you drawing it in a 1:1 ratio, so that it's drawn at exactly 5x5 pixels, and you've just resized it after you took the screenshot?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this