I think you want to avoid the raw texture APIs and OpenGL buffers and stick with the Libgdx Mesh and Texture wrappers. They hide a bunch of OpenGL details. Of course, if you are interested in learning the details of OpenGL, this will not help. (But perhaps you can get everyone to work with the Libgdx APIs and then look at their source to see what is actually happening).
The first step is to make sure that your Mesh (or your original mVertexBuffer OpenGL list, if you are not using Mesh ) contains the correct (u, v) texture coordinates with each vertex. These coordinates will refer to the βcurrentβ texture during rendering. See https://code.google.com/p/libgdx/wiki/MeshColorTexture#Texture .
First, define your Mesh to include text information with each vertex:
mesh = new Mesh(true, 3, 3, new VertexAttribute(Usage.Position, 3, "a_position"), new VertexAttribute(Usage.ColorPacked, 4, "a_color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
(This grid also has color data, but you can leave a line with "a_color" if you don't want to mix raw color data.)
Another preload step is to load the texture file into the Libgdx texture. Assuming the file is packaged in the standard location βassetsβ, you should simply download it with a relative path:
Texture texture = new Texture("path/to/image.bmp");
Libgdx can usually download and parse BMP, PNG, and JPEG files. For other formats, I think you need to create a Pixmap object yourself, and then connect it to the Texture .
Secondly, make sure that each vertex has (u, v) texture coordinates associated with it:
mesh.setVertices(new float[] { -0.5f, -0.5f, 0, Color.toFloatBits(255, 0, 0, 255), 0, 1, 0.5f, -0.5f, 0, Color.toFloatBits(0, 255, 0, 255), 1, 1 0, 0.5f, 0, Color.toFloatBits(0, 0, 255, 255), 0.5f, 0 });
Each line above defines "(x, y, z, rgba, u, v)" for each vertex. ("Rgba" is all color compressed into one float.)
At this point, you have defined Mesh with the coordinates of the information and texture (u, v) Color .
The second step is to link your texture during the render call, so that the coordinates (u, v) in Mesh have a link:
texture.bind(); mesh.render(GL10.GL_TRIANGLES, 0, 3);
You do not need to use any of the OpenGL APIs or vertices.