• Advertisement
Sign in to follow this  

Why my sprites don't display correctly ?

This topic is 3113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Try offsetting your coordinates by 0.5f, so that x isn't 100.0f, but 100.5f for example. Pixels are mapped that way in D3D9.

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
Sign in to follow this  

  • Advertisement