Jump to content
  • Advertisement

Archived

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

JohanL

Texturing complications...

This topic is 5773 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''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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!