texcoord question

Ok, maybe this is an absolutely unimportant question, but i want to be sure, that it has no impact.

When i apply texcoords to my objects i don´t bother to check, that they start in the range between 0 and 1. I.e. a quad has the texture coordinates:

500/500-----2000/500
| |
| |
| |
500/100-----2000/100

Instead they could be:

0/400-----1500/400
| |
| |
| |
0/0-------1500/0

Does any gfx card bother about this or can i just leave it like this?

Jan.

Of course it’s legal.
Look up texture wrapping and clamping.

Yes, i know that it´s legal. But i forgot to ask the question more precise.

  1. Is there any performance hit, if the hardware has to clamp big values (i heard that hardware is specialized for some special cases, for example zero divided by some value is calculated much faster than other divisions).

  2. Because of the floating-point texcoords, may i loose precision if i work with big values ?

Jan.

PS: My “painting” got messsed up by HTML. The second vertical line should be under the rightmost numbers (to form a quad).

There is no performance hit, but you will lose precision.

The small difference in your example won’t matter though. If you use 1000-1001 instead of 0-1 (numbers are 1000x larger), you may see something. Size of the texture also affects this so that problems appear sooner in larger textures.

Try to increase the numbers a lot (by 1000, 1000000, 1000000000…) and look at the results. You will quickly see at which point the particular card you use starts to show
problems.

Also note that most cards do have a maximum texture coordinate precision, above which the texture starts to distort and warp. For ARB_fragment_program cards, they may be using full IEEE 32-bit floats, but that may not be true for earlier cards.

I don’t think that texture coordinates greater than 1024 or 2048 (or something in that range) are guaranteed to work from the OpenGL spec. I forget the exact number, but you can see this problem if you load up the Serius Sam 2 demo and run outside the playing area until you get bored… eventually the ground texture starts to act crazy.