OpenGL repeating texture question

so i want to create a User Interface in my game using opengl. So i’m thinking the simplest solution is to create a quad and render my texture onto it. except i seem to run into a bit of trouble.

this is my image for the border of the quad



So i first i create 4 quads, 1 for each corner and then take the corners from my texure and map only the corners of the image to the quad accordingly… ok, so far so good.



now i hit trouble. I want the quad to repeat the top, botom and side borders, so that the quad can be any size and it looks ok. Which should be simple enough except i don’t know how to make the quad repeat the texture with out including the corners of the image. The only solution that i can think of is to create a seperate texture for each border… which just doesn’t efficient… what i’m basically asking is how can i tell opengl to only repeat a portion of the texture and not the entire image. THANKS EVERYONE!!!

i'm thinking now… isn't all that i really need is 1 corner and 1 border. Then i can just map the texture coordinates differently?

(Goes to try it)

if you can cope with the coding style, this might help:

http://gbui.googlecode.com/svn/trunk/src/java/com/jmex/bui/background/ImageBackground.java

yeeeesh… that is some scary code… even so its also JME code… i'm using straight up opengl for this program… sooo…  i think my solution should be able to do the trick though :slight_smile:



thanks though!