Archived

This topic is now archived and is closed to further replies.

Texture alignment problem

This topic is 5871 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

I''ve been dealing with a small texture alignment problem in D3D and I was wondering if there is an official fix for it. I create a simple triangle strip (4 vertices in a Z shape) for my sprites. The problem is, when I rotate the sprite at 90° increments, or if I flip the texture coordinates around (to flip the sprite), there will always be a 1-pixel offset on the left and/or top edge(s) depending on how much you rotated the sprite. Hmm.. Hard to describe. Imagine a 100x100 sprite who''s texture is offset by 1 pixel so the left and top edges are empty, and the right and bottom edges of the texture dont show since it''s off the edge of the sprite quad. Is there a way to fix this w/o tweaking the texture coordinates? Is this a card-specific problem? Thanks! -- Dan (flaXen) PS: Hehehe. Who''s idea was it to use a single-precision floating point number which can only range from 0.0 to 1.0 for texture coordinates??? This person should be shot. The drawbacks far outweigh the gains for such a system.

Share this post


Link to post
Share on other sites
I''m not sure this is it, but look up "Triangle Rasterization Rules" in the Direct X SDK. It might be a small rounding error that is causing the top left row/column to get cut off because of the top-left filling way D3D rasterizes polys.

I''d guess texture coords are relative values instead of pixel coordinates of the texture because when the card is interpolating the texture coordinates, as it rasterizes the poly, it wants a proportion anyways. It wouldn''t make sense to specify pixel values anyways, since mip mapped textures don''t have a single width, and if the texture coordinates are not normalized, then you have to be concerned about passing in the width and hieght of the texture also.

Share this post


Link to post
Share on other sites