I'm trying to apply a texture to 4 different triangle strips using JOGL (OpenGL/Java). I'm trying to make a 1000×1000 path in a square, where the path is 100 wide. The texture should be stamped 10 times on each side (though the corner pieces will have a diagonal discontinuity). I'm making 4 trapezoids here:
float[] positions = { /* S,W,N,E */
500,-50,500, 400,-50,400, -500,-50,500, -400,-50,400,
-500,-50,500, -400,-50,400, -500,-50,-500, -400,-50,-400,
-500,-50,-500, -400,-50,-400, 500,-50,-500, 400,-50,-400,
500,-50,-500, 400,-50,-400, 500,-50,500, 400,-50,400
};
float[] textureCoords = {
0f,0f, 1f,1f, 0f,10f, 1f,9f,
0f,0f, 1f,1f, 0f,10f, 1f,9f,
0f,0f, 1f,1f, 0f,10f, 1f,9f,
0f,0f, 1f,1f, 0f,10f, 1f,9f
};
I then get this data into VBOs, and every frame I draw with the following code:
gl.glActiveTexture(GL_TEXTURE0);
gl.glBindTexture(GL_TEXTURE_2D, textureIDs[0]);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
for (int i=0; i<4; i++) gl.glDrawArrays(GL_TRIANGLE_STRIP, i*4, 4);
The texture appears to be loading fine. You can see that it looks okay in one triangle of the trapezoid, within the range (0,0 -> 1,1). But as soon as my interpolated (s,t) values leave that range, it just smears things. I'm very confused by this--isn't it supposed to tile, when I have texture coordinates beyond 1.0? Does this have something to do with using GL_TRIANGLE_STRIP to draw?