for (int i = 0; i < face[0].length; i++) {
bufferVertex.put(vertexX[face[0][i]]);
bufferVertex.put(vertexY[face[0][i]]);
bufferVertex.put(vertexZ[face[0][i]]);
bufferVertex.put(vertexX[face[1][i]]);
bufferVertex.put(vertexY[face[1][i]]);
bufferVertex.put(vertexZ[face[1][i]]);
bufferVertex.put(vertexX[face[2][i]]);
bufferVertex.put(vertexY[face[2][i]]);
bufferVertex.put(vertexZ[face[2][i]]);
bufferNormal.put(normalX[faceNorm[0][i]]);
bufferNormal.put(normalY[faceNorm[0][i]]);
bufferNormal.put(normalZ[faceNorm[0][i]]);
bufferNormal.put(normalX[faceNorm[1][i]]);
bufferNormal.put(normalY[faceNorm[1][i]]);
bufferNormal.put(normalZ[faceNorm[1][i]]);
bufferNormal.put(normalX[faceNorm[2][i]]);
bufferNormal.put(normalY[faceNorm[2][i]]);
bufferNormal.put(normalZ[faceNorm[2][i]]);
}
for (int i = 0; i < faceTex[0].length; i++) {
bufferTexture.put(textureU[faceTex[0][i]]);
bufferTexture.put(textureV[faceTex[0][i]]);
bufferTexture.put(textureU[faceTex[1][i]]);
bufferTexture.put(textureV[faceTex[1][i]]);
bufferTexture.put(textureU[faceTex[2][i]]);
bufferTexture.put(textureV[faceTex[2][i]]);
}
bufferVertex.flip();
bufferTexture.flip();
bufferNormal.flip();
bufferIndice.flip();
GL11.glVertexPointer(3, 0, bufferVertex);
GL11.glNormalPointer(0, bufferNormal);
GL11.glTexCoordPointer(2, 0, bufferTexture);
Those face arrays contain the index of the vertex/normal/texcoord of the appropriate array. The 0,1,2 are for the three corners of the triangles.
Using this method I have multiple vertices that are the same in bufferVertex. I would rather use glDrawElements but I can’t seem to get that to work still. If anyone can help thanks in advance.