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


Texture alignment problem

Recommended Posts

flaXen    122
I really need help with this. It''s driving me out of my mind. I have a real bad texture alignment problem. ALL of my textures for my sprites aren''t correct. Each sprite has its actual width and its padded with. Sprites dimensions that aren''t powers of 2 end up getting padded to the next nearest power of 2 (in most situations). SO... If I have a 88x44 sprite, it gets padded to 128x64. Ok.. So texture coordinates. The right-edge is then: 1.0 / 128.0 * 88.0 = 0.6875 and the bottom edge happens to be the same. So if I had a sprite that used 100% of its normal area, the top-left UV coordinates are 0.0, 0.0 and the bottom-right UV coordinate is 0.6875, 0.6875. The sprite is then drawn at 0,0. Its bottom-right corner is 43,43. When I draw the sprite, it draws correctly. HOWEVER, i allow for 90° rotation and H- and/or V-flipping. In each combination of rotation+h/v flips, the texture is out-of alignment. I''ve heard mention of offseting the texture and/or polygon coordinates. Does anyone have specific details about this? I need as much info as I can get. I know that with nVidia cards you can tell D3D to offset the texel alignment in the display control panel. I can''t imagine why they would even allow this when there should be a standard for it. Anyway.. Can I force it to use the upper-lefthand corner of texels? If not, is there a portion of a texel I can manually offset that will work on most cards? ANY information would be helpful! Thanks, -- Dan

Share this post

Link to post
Share on other sites