• Create Account

We're offering banner ads on our site from just \$5!

### #Actualvoodoodrul

Posted 03 July 2013 - 10:25 PM

Okay, so I have tweaked this a bit:

//Interleaved array - vertex3f, normal3f, color3f, u,v
//bottom face
new float[]{
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, -1, 0, color[0], color[1], color[2], 1, 1,
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,// v7-v4-v3bottom
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,
x, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,// v3-v2-v7
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0
},
//back face
new float[]{
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x, y, z, 0, 0, -1, color[0], color[1], color[2], 1, 1,
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,// v4-v7-v6back
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,
x + 1, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0
}


As you can see, each face begins with a degenerate and ends with one. I basically stick these faces together in any order, so I start drawing a chunk and draw block1->face1, block1->face 3, block2->face2, ..., blockN->faceN

I start drawing at offset one

GL11.glDrawArrays(GL11.GL_TRIANGLES, 1, this.numVerts);


since I want to draw this array but I probably shouldn't start off by drawing a degenerate.

The problem is that my degenerates are still wrong, or at least they are being toggled in ways I'm not expecting. They seem to be toggling on and off which results in this trippy  scene.

### #6voodoodrul

Posted 03 July 2013 - 06:38 PM

Okay, so I have tweaked this a bit:

            //bottom face
new float[]{
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, -1, 0, color[0], color[1], color[2], 1, 1,
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,// v7-v4-v3bottom
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,
x, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,// v3-v2-v7
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0
},
//back face
new float[]{
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x, y, z, 0, 0, -1, color[0], color[1], color[2], 1, 1,
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,// v4-v7-v6back
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,
x + 1, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0
}


As you can see, each face begins with a degenerate and ends with one. I basically stick these faces together in any order, so I start drawing a chunk and draw block1->face1, block1->face 3, block2->face2, ..., blockN->faceN

I start drawing at offset one

GL11.glDrawArrays(GL11.GL_TRIANGLES, 1, this.numVerts);


since I want to draw this array but I probably shouldn't start off by drawing a degenerate.

The problem is that my degenerates are still wrong, or at least they are being toggled in ways I'm not expecting. They seem to be toggling on and off which results in this trippy  scene.

### #5voodoodrul

Posted 03 July 2013 - 06:37 PM

Okay, so I have tweaked this a bit:

//bottom face
new float[]{
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, -1, 0, color[0], color[1], color[2], 1, 1,
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,// v7-v4-v3bottom
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,
x, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,// v3-v2-v7
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0
},
//back face
new float[]{
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x, y, z, 0, 0, -1, color[0], color[1], color[2], 1, 1,
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,// v4-v7-v6back
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,
x + 1, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0
}

As you can see, each face begins with a degenerate and ends with one. I basically stick these faces together in any order, so I start drawing a chunk and draw block1->face1, block1->face 3, block2->face2, ..., blockN->faceN

I start drawing at offset one

[code=auto:0]

GL11.glDrawArrays(GL11.GL_TRIANGLES, 1, this.numVerts);

[code=auto:0]
since I want to draw this array but I probably shouldn't start off by drawing a degenerate.

The problem is that my degenerates are still wrong, or at least they are being toggled in ways I'm not expecting. They seem to be toggling on and off which results in this trippy  scene.

### #4voodoodrul

Posted 03 July 2013 - 06:30 PM

Okay, so I have tweak this a bit:

//bottom face
new float[]{
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, -1, 0, color[0], color[1], color[2], 1, 1,
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,// v7-v4-v3bottom
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,
x, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,// v3-v2-v7
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0
},
//back face
new float[]{
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x, y, z, 0, 0, -1, color[0], color[1], color[2], 1, 1,
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,// v4-v7-v6back
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,
x + 1, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0
}

As you can see, each face begins with a degenerate and ends with one. I basically stick these faces together in any order, so I start drawing a chunk and draw block1->face1, block1->face 3, block2->face2, ..., blockN->faceN

I start drawing at offset one:
GL11.glDrawArrays(GL11.GL_TRIANGLES, 1, this.numVerts);

Since I want to draw this array but I probably shouldn't start off by drawing a degenerate.

The problem is that my degenerates are still wrong, or at least they are being toggled in ways I'm not expecting. They seem to be toggling on and off which results in this trippy  scene.

### #3voodoodrul

Posted 03 July 2013 - 06:28 PM

Okay, so I have tweak this a bit:

//bottom face
new float[]{
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, -1, 0, color[0], color[1], color[2], 1, 1,
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,// v7-v4-v3bottom
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,
x, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,// v3-v2-v7
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0
},
//back face
new float[]{
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x, y, z, 0, 0, -1, color[0], color[1], color[2], 1, 1,
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,// v4-v7-v6back
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,
x + 1, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0
}

As you can see, each face begins with a degenerate and ends with one. I basically stick these faces together in any order, so I start drawing a chunk and draw block1->face1, block1->face 3, block2->face2, ..., blockN->faceN

I start drawing at offset one:
GL11.glDrawArrays(GL11.GL_TRIANGLES, 1, this.numVerts);

Since I want to draw this array but I probably shouldn't start off an empty array with a degenerate.

The problem is that my degenerates are still wrong, or at least they are being toggled in ways I'm not expecting. They seem to be toggling on and off which results in this trippy  scene.

### #2voodoodrul

Posted 03 July 2013 - 06:23 PM

Okay, so I have tweak this a bit:

//bottom face
new float[]{
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, -1, 0, color[0], color[1], color[2], 1, 1,
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,// v7-v4-v3bottom
x + 1, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 1, 0,
x, y, z + 1, 0, -1, 0, color[0], color[1], color[2], 0, 0,
x, y, z, 0, -1, 0, color[0], color[1], color[2], 0, 1,// v3-v2-v7
x, y, z, 0, 0, 0, 0, 0, 0, 0, 0
},
//back face
new float[]{
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x, y, z, 0, 0, -1, color[0], color[1], color[2], 1, 1,
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,// v4-v7-v6back
x, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 1, 0,
x + 1, y + 1, z, 0, 0, -1, color[0], color[1], color[2], 0, 0,
x + 1, y, z, 0, 0, -1, color[0], color[1], color[2], 0, 1,
x + 1, y, z, 0, 0, 0, 0, 0, 0, 0, 0
}

As you can see, each face begins with a degenerate and ends with one. I basically stick these faces together in any order, so I start drawing a chunk and draw block1->face1, block1->face 3, block2->face2, ..., blockN->faceN

I start drawing at offset one:
GL11.glDrawArrays(GL11.GL_TRIANGLES, 1, this.numVerts);

Since I want to draw this array but I probably shouldn't start off an empty array with a degenerate.

The problem is that my degenerates are still wrong, or at least they are being toggled in ways I'm not expecting. They seem to be toggling on and off which results in this trippy  scene.

PARTNERS