Ok, so i made a little headway, although I do not understand exactly what these offsets mean. I made the following changes to the render code above, notice the index_buffer_offset parameters.
if ((z + 1 >= max_z) || (z + 1 < max_z && openglbook.world_blocks[(int)y][(int)x][(int)z+1] == 0)) {
GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, 36, 6, GL11.GL_UNSIGNED_INT, 0);
}
// x, y, z - 1 (back) block id == 0 then draw back.
if ((z-1 < 0) || (z-1 >= 0 && openglbook.world_blocks[(int)y][(int)x][(int)z-1] == 0)) {
GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, 36, 6, GL11.GL_UNSIGNED_INT, 48);
}
// x, y + 1, z (top) block id == 0 then draw top.
if ((y+1 >= max_y) || (y + 1 < max_y && openglbook.world_blocks[(int)y + 1][(int)x][(int)z] == 0)) {
GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, 36, 6, GL11.GL_UNSIGNED_INT, 120);
}
// x, y - 1, z (bottom) block id == 0 then draw bottom.
if ((y-1 < 0) || y - 1 >= 0 && openglbook.world_blocks[(int)y-1][(int)x][(int)z] == 0) {
GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, 36, 6 , GL11.GL_UNSIGNED_INT, 96);
}
// x -1, y, z (left) block id == 0 then draw left.
if ((x-1 < 0) || x - 1 >= 0 && openglbook.world_blocks[(int)y][(int)x-1][(int)z] == 0) {
GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, 36, 6 , GL11.GL_UNSIGNED_INT, 72);
}
// x +1, y, z (right) block id == 0 then draw right.
if ((x+1 >= max_x) || x + 1 < max_x && openglbook.world_blocks[(int)y][(int)x+1][(int)z] == 0) {
GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, 36, 6 , GL11.GL_UNSIGNED_INT, 24);
}
I started playing around with the parameters to see whether or not I would either get 1) the desired effect, or 2) an exception/error. I first played around with the start/end parameters and found that they aparently do nothing. I can set them to whatever I want, even negative numbers and I the outcome does not change. So i moved on to the total_indices parameter, which had the effect of, starting at the beginning of the array and rendering that number of vertices. This was no good because each face only contains two faces, i.e 6 vertices. Then i started messing around with the index_buffer_offset (the last parameter) and I originally thought this was the offset it used as a starting point, but it does not make sense because I definately do not have 72/120/96 vertices.
The only thing i can think of is that this offset is possibly in bytes?
Either way this produced the desired goal of rendering, but I wonder if this is working the way it should. I am at a loss when it comes to render strategies. I am using backface culling but that does not fully give me the desired outcome. That only culls the back of each rendered cube. Is there another way, besides checking at the time of cube render which faces should be rendered so that, say a 100 x 100 set of cubes only draws the outside layer of cubes since the inner cubes will never be visible?