Jump to content
  • Advertisement

Archived

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

TechnoCore

tu & tv coordinates

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

Hi! I have made a simple terrain-engine, where i use a set of 64*64 tiles. These tiles are put into a large 1024*1024 texture. I cant seem to set the tv and tu coordiantes correctly. they should be from 0.0f to 1.0f, so I want to get the first tile, how should i pick the coordinates ? I now use left: 0.0f top: 0.0f right 63.0/1024.0f bottom 63.0/1024.0f I get lines at the border of this tile... and i have tried all kind of different ways to pick the coordianes... but just cant seem to get it right. Is there no way to choose the coordinates by pixel-level instead of floats ?

Share this post


Link to post
Share on other sites
Advertisement
The simplest way is to contract by half a pixel:

halfpix = (1.0/1024.0) * 0.5

left = halfpix
right = 63.0/1024.0f - halfpix
top = halfpix
bottom = 63.0/1024.0f - halfpix

that should help somewhat

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks, JuNC and Mark Sheeky

JuNC: Ill try it right away
Mark: Thats really weird, cant that info be found in the caps or something ?

Why did they do it with floats ?! Imho that is really stupid.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!