Hey guys, I have been working on a 3D mesh system based on adding polygons to the mesh. However, I have run into an issue!

Whats happening is the extra triangle returning to the origin is being added, and I am clueless as to why.
public void createMesh(){
Tessellator t = new Tessellator();
t.setColour(0.7f, 0.2f, 0.2f, 1f);
t.addPoly(new Vector3f[]{
new Vector3f(120, 120, 1f), new Vector3f(80, 120, 1f), new Vector3f(100, 200f, 1f)
}, null);
t.setColour(1f, 0f, 0f, 1f);
t.addPoly(new Vector3f[]{
new Vector3f(120, 120, 1f), new Vector3f(200, 120, 1f), new Vector3f(160, 200f, 1f),
}, null);
t.setColour(0f, 1f, 0f, 1f);
t.addPoly(new Vector3f[]{
new Vector3f(120, 120, 1f), new Vector3f(200, 120, 1f), new Vector3f(160, 80f, 1f)
}, null);
mesh = t.generateMesh();
}
That is the code for setting the vertices and colours.
public void render() {
preRender();
doRender();
postRender();
}
public void preRender() {
glEnableClientState(GL_VERTEX_ARRAY);
if (hasTexCoords || hasTexLighting) glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if (hasColour) glEnableClientState(GL_COLOR_ARRAY);
if (hasNormals) glEnableClientState(GL_NORMAL_ARRAY);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboVertexBuffer);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboIndexBuffer);
glVertexPointer(VERTEX_SIZE, GL11.GL_FLOAT, stride, vertexOffset);
if (hasTexCoords) {
GL13.glClientActiveTexture(GL13.GL_TEXTURE0);
glTexCoordPointer(TEX_COORD_SIZE, GL11.GL_FLOAT, stride, texCoordOffset);
}
if (hasTexLighting) {
GL13.glClientActiveTexture(GL13.GL_TEXTURE1);
glTexCoordPointer(TEX_LIGHTING_SIZE, GL11.GL_FLOAT, stride, texLightingOffset);
}
if (hasColour) glColorPointer(COLOUR_SIZE, GL11.GL_FLOAT, stride, colourOffset);
if (hasNormals) glNormalPointer(GL11.GL_FLOAT, stride, normalOffset);
}
public void postRender() {
if (hasNormals) glDisableClientState(GL_NORMAL_ARRAY);
if (hasColour) glDisableClientState(GL_COLOR_ARRAY);
if (hasTexCoords || hasTexLighting) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
}
public void doRender() {
GL11.glDrawElements(GL11.GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
}
And thats the render code for the mesh.
If anyone can point me towards what I am doing wrong, I would be greatly appreciative!

Find content
Not Telling