Rendering part of a texture with GL_REPEAT or GL_CLAMP?

Say I have a 64x64 Texture that contains pictures to be used in drawing GUI. Obviously to display smaller parts of that image for each part of the GUI I would have to REPEAT or CLAMP the texture (as stretching makes it look uglier), how would I do this if my glTexCoord2f coords are different than 0 and 1, and instead something like 0.013f, 0.127f?

Also I was wondering, is there any way to set it so the top left corner of a texture is 0,0, rather than the bottom left? Kinda like how you can change the coordinates to 0,0 to top left with
glOrtho(0, x, y, 0, near_clip, far_clip);

You can’t clamp/repeat a sub image of a texture. At least not without a shader.

As for flipping the image. Well, flip the image. Open it in a paint program and mirror it up side down. Now the origin is effectively in the other corner.

Originally posted by Bob:
[b] You can’t clamp/repeat a sub image of a texture. At least not without a shader.

As for flipping the image. Well, flip the image. Open it in a paint program and mirror it up side down. Now the origin is effectively in the other corner. [/b]
I guess i’ll have to learn to create shaders.

Flipping it upside down would cause some obvious issues, I mean having the texture coordinates be in the actual top left corner of the textured quad thats being displayed.

as a workaround you could subivide the quad and give the smaller quads the same texture coordinates as the big one.

Originally posted by zeoverlord:
as a workaround you could subivide the quad and give the smaller quads the same texture coordinates as the big one.
You mean draw multiple quads with the same texture?

I have no experience, but what about splitting the original texture up into multiple textures (through some form of render to texture) and then using 0,1 for coords and being able to clamp.

Or split the texture up outside of opengl and only pass the split textures so you dont have to deal with sub images.

Originally posted by <saluk>:
[b] I have no experience, but what about splitting the original texture up into multiple textures (through some form of render to texture) and then using 0,1 for coords and being able to clamp.

Or split the texture up outside of opengl and only pass the split textures so you dont have to deal with sub images. [/b]
Yes but theres teh whole power of 2 thing, I believe you can load a part of an image as a texture of its own anyway.