View Full Version : texcoord question

04-17-2003, 02:30 AM
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:

| |
| |
| |

Instead they could be:

| |
| |
| |

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


04-17-2003, 02:53 AM
Of course it's legal.
Look up texture wrapping and clamping.

04-17-2003, 03:30 AM
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 ?


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

04-17-2003, 05:25 AM
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

04-17-2003, 06:52 AM
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.

04-17-2003, 09:02 AM
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.