Original Post
Hi This is probably the dumbest question ever but I am not able to figure it out myself. The premiss is, I have OGL-ES and I use vertex buffers with indices. Everything worked fine as long as I do not want to map a texture on it. The prior model was a simple cube. Looked fine with every color. Now I just want to add a texture to each face. So, I thought I use texturebuffer, set the glTexCoordPointer and everything will be fine. But for me it won't work. I see the texture, so texture is loaded fine but somehow I cannot figure out how the texture coordinates have to be. I already reduced it to a square but still, I see a texture but it is mirrored for each of the triangles. Because of OGLES I use GL_TRIANGLES, tried strip already, but nothing works. At the moment I do not see anything more and just tested nearly every combination I can think of. So I enabled both and set my both buffers.
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertexBuffer);
glTexCoordPointer(2, GL_FLOAT, 0, textureBuffer);
I have four vertices (also tested all way rounds)
-1.0f, -1.0f, 1.0f, //v0
1.0f, -1.0f, 1.0f, //v1
-1.0f, 1.0f, 1.0f, //v2
1.0f, 1.0f, 1.0f, //v3
The indices
0,1,3, 0,3,2 //f1
And now the texture coordinates
1.0f, 1.0f,
0.0f, 1.0f,
0.0f, 0.0f,
1.0f, 0.0f,
0.0f, 1.0f,
1.0f, 1.0f
This is just the last version of my tests. I actually even do not get how OGLES uses them, how many etc. Tried 2, 4, 6, 100, all way round. The results are so different. Currently with these settings the texture is there but mirrored between the two triangles. Please excuse dumb errors but I just don't get it anymore. I draw on paper many figures, tried to do everything based on these, but nothing will work. I just do not understand it. I hope anyone can help me here. Many thanks in advance.