I've created a plane at OpenGL with this code:

```
glBegin(GL_TRIANGLE_STRIP);
glColor4f(0.8, 0.8, 0.5, 1.0);
glVertex3f(startlen, height, startwid);    
glVertex3f(startlen, height, startwid + width);
glVertex3f(startlen + length, height, startwid);
glVertex3f(startlen + length, height, startwid + width);
glEnd();

```

Now I want to apply a texture to this plane. 

I've read this tutorial [here](http://www.opengl-tutorial.org/beginners-tutorials/tutorial-5-a-textured-cube/) but I've stopped at the "Using the texture in OpenGL" part because I don't have the UV coordinates.

*I know that we have to import the texture file, in my case a bitmap file.  

The loader returns a Glint, which is the textureID, is that global? In example, if I need to load that texture I simply need to call the bind texture function with the ID given?*

Anyway, how can I apply the texture to the plane?

---

**EDIT #1:**
The texture at the example mosquito posted works now.  

What I found out was that I was loading the texture into the constructor of the class and I shouldn't because the object was public and it was constructed before OpenGL's initialization.  

So the texture now loads fine at the quad example :) 

The problem now is that I've tried to use it at my plane and it looks distorted.
The solution to this is probably enabling the texture to be loaded several times but keep it's original size *(although I don't know how to do this)*.

Also, I've created another plane next to the current one with a cream colour but after the texturing it seems like this:
![enter image description here](https://i.stack.imgur.com/ReKnZ.png)

So there are 2 problems now:

* texture must keep it's original resolution but displayed as many times as to cover the whole plane
* the plane next to it, has lost its colour (why did this happen? How to fix it? -- I might use a texture for this plane as well)

---

**Edit #2:**

2nd problem has been fixed now, thanks to mosquito!
But the tiling still doesn't work.
This is how it looks now:
![enter image description here](https://i.stack.imgur.com/dSzWW.png)

And this is the texture I've used:  

![enter image description here](https://i.stack.imgur.com/bjBGT.png)  

Its dimensions are 256x256 (I've used an image editor to crop it)

---

**Edit #3:**  

These are the glTexCoord2f coordinates with their matching vertices (for the inner margin):

```
glTexCoord2f(0.0f, 0.0f);   glVertex3f(startlen, height, startwid);
glTexCoord2f(0.0f, 1.0f);   glVertex3f(startlen, height, startwid - width/2);
glTexCoord2f(1.0f, 0.0f);   glVertex3f(startlen + length, height, startwid);
glTexCoord2f(1.0f, 1.0f);   glVertex3f(startlen + length, height, startwid - width/2);

```