tu & tv coordinates

Started by
3 comments, last by TechnoCore 21 years ago
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 ?
//TechnoCore
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
Actually the -exact- pixel changes from graphics card to card so you can never get it perfect on every machine.

Mark
Bytten Independent Games Magazine
http://www.bytten.com
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.
Oh forgot to add my name
//TechnoCore

This topic is closed to new replies.

Advertisement