Rendering part of a texture

Hey guys,

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[2];

         coords[0].x = 0.0f;
         coords[0].y = 0.0f;

         coords[1].x = getUForPixel(20);
         coords[1].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?