If you do this with texturing turned on:
Code:
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
You're drawing the first four points in your vertex array, using the first four points in your texture array. You must have set the texture point array somewhere. Search for glTexCoordPointer to find out where.
The range and magnitude of the vertices in moveableSquare[] has NO impact which part of the texture is used. Only the order of the points matters, and the texture coordinates. Let me explain using squares, because it's less confusing; I'm also going to assume a square is defined as two points (upper left, bottom right.) You'll have to work out how the triangles work, once you understand my squares.
Suppose I draw a square to the screen - the position and side doesn't matter. I also have a texture of a smiley face. If I set the texture coordinates for the upper-left and bottom-right as 0,0 and 1,1 then the entire smiley face will be drawn on the face of the square. Soak that in - the texture will be shrunk or stretched as appropriate, but it will appear only once on the face of the square. If I double the size of the square and rotate it, I see one smiley, rotated, at double the size.
If I set my texture coordinates as (0,0) and (0.5, 0.5) , then I will see one quarter of the smiley face - just the upper left corner and left eye. Sketch this out on a piece of paper if you need to.
With regards to tiling, if I set my coordinates as (0,0) and (2,2) , I will see four smileys on the face of the square (unless I turned clamping on). Two across, two down. There's your tiling.
This it probably very different than what's shown in many 3D programs, where one inch of texture covers one inch in world units, and repeats as necessary; but it makes much sense if you think about it. If you double the size of an object, you don't want the texture to start repeating on its own, do you? You want it to stretch to the object. And you don't want the texture to "flow" across the object as the object moves, right?
That's why the range of vertices don't matter. If I had to sum this up succinctly, I'd write "Point 1 in the vertex array is painted using point 1 from the texture array. Vertex point 2 is painted from texture point 2, etc. Everything else is interpolated."
Now, the squares you're drawing are made of two triangles, defined by four points, but the rules are the same. This stuff is in the OpenGL red book by the way, which is a very useful reference; even old (1.x) versions, which are available for under $10.
http://www.amazon.com/gp/redirect.ht...reative=390957