Texturing complications...

Started by
2 comments, last by JohanL 21 years, 4 months ago
I''m trying to blit a "sprite" through D3D with 4 transformed vertices from 0,0 to 63,63 (64x64 pixels), and I have a texture in a PNG file which is 64x64 pixels but when it gets drawn on screen only 63x63 pixels is drawn... I''m using 0 and 1 as tu and tv respectively on the vertices to make sure that I''m using the entire texture but obviously that doesnt occur... Am I missing something trivial or whats happening? Regards Johan
Advertisement
You might want to try not using 0,0 to 63,63, but 64,64.
Also, don''t use UV coordinates 0 and 1, but 0.5/texturesize and 1-0.5/texturesize, as that will hit the centres of the pixels exactly.

- JQ
Full Speed Games. Are back.
~phil
The solution you suggester JQ did not help unfortunately, I''ve still only see the first 63 pixels of the texture, and when I choose to draw the "sprite" from 0,0 to 64,64 it stretches the texture in the middle so I still see only 63 pixels and one of the pixels in the middle (around 32) is not shown twice...

I am using DX9 and C#...

Regards

JohanL
1) Try disabling bilinear filtering.

2) Try setting the texture address mode to CLAMP.

3) Read the section of the docs entitled "Directly Mapping Texels to Pixels" (that''s what it''s called in the C++ documentation anyway). The reason is down to the interpretation of what 0 and 1 actually mean - left of a pixel, right of a pixel or centre...


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement