How to have a texture go from -1 to + 1?

I understand how to use a 2D texture but I don’t know how to have the texture applied to an object that extends from -1 to + 1 for example. I know you can set parameters to repeat the texture or clamp it to values that fall outside the range but how to specify a range other than 0 to 1?
I want to have a color gradient which goes from -1 (blue) to + 1(red). How is this done?
Thanks, Tom

If you know up-front the spatial region (e.g. -1…1), you can just specify 0…1 texture coordinates across that region. If you don’t, then you can have the GPU generate these texture coordinates dynamically using what’s called texture coordinate generation (texgen, for short).

If you render your geometry with shaders, this is easy. You can do whatever you want here (as you write the code which transforms your input values into texture coordinates).

Pre-shaders, there was texture combiners / register combiners which allowed you do some of this.

And even back before those days, there was some limited support for texgen.

Thanks got it.!