I'm looking to render part of a texture, say (a 20x20px segment). So far, I have calculated everything I need and know the precise region that I want a quad to render, though I'm stuck at how to tell the quad which part of the texture to clip to.
I've tried two methods, but don't seem to be able to get it right. Firstly is loading only a portion of a massive texture (1000px x 1000px) into it's own texture. And secondly, setting texture co-ords. I believe the latter is the best method, though I don't understand what values I can give.
Vector2f coords = new Vector2f;
coords.x = 0.0f;
coords.y = 0.0f;
coords.x = getUForPixel(20);
coords.y = getVForPixel(20);
This doesn't work, and displays some strange adaption of the entire texture.
If my explanation doesn't cut it, I'm pretty much making a key character map in a bitmap and displaying chinese characters with them. (Very much like loading a tile set and rendering tiles..)
Does anyone have any hints / tips / better ways to do this?