Pixel-based Texture co-ordinate range by Dranith

Motive

When I started with OpenGL one of the things I found most confusing was how texture coordinates had to be 0-1 no matter what. I asked around and always got that same answer. What I wanted is to be able to input texture coordinates in pixels. Well now that I know more, here is the code to set that up =).

If you are careful with matrix pushes and pops, this will only have to be called once, so I didn't bother with any optimisations at all. Wanted it to be straightforward and easy to read. Usage is as follows. If you want to set it up so you can input coordinates in 1-128 instead of 0-1: