if (glChunk == null || glChunk.buffer == null)
continue;
gl.glPushMatrix();
Vector2d hexPosition = new Vector2d();
HexGeometry.hexToCartesian(position.x, position.y, hexPosition);
gl.glTranslatef((float) (hexPosition.x * 16),
(float) (hexPosition.y * 16), position.z * 16);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, glChunk.buffer.id[0]);
gl.glVertexAttribPointer(0, 3, GL.GL_FLOAT, false, 9*4, 0);
gl.glVertexAttribPointer(1, 2, GL.GL_FLOAT, false, 9*4, 3*4);
gl.glVertexAttribPointer(2, 4, GL.GL_FLOAT, false, 9*4, 5*4);
gl.glEnableVertexAttribArray(0);
gl.glEnableVertexAttribArray(1);
gl.glEnableVertexAttribArray(2);
float[] mv = new float[16];
gl.glGetFloatv(GL2.GL_MODELVIEW_MATRIX, mv, 0);
gl.glUniformMatrix4fv(ssUMVMatrix, 1, false, mv, 0);
float[] p = new float[16];
gl.glGetFloatv(GL2.GL_PROJECTION_MATRIX, p, 0);
gl.glUniformMatrix4fv(ssUPMatrix, 1, false, p, 0);
gl.glUniform1i(ssTex, 0);
gl.glDrawArrays(GL.GL_TRIANGLES, 0, glChunk.buffer.size / (4 * 9));
gl.glDisableVertexAttribArray(0);
gl.glDisableVertexAttribArray(1);
gl.glDisableVertexAttribArray(2);
gl.glPopMatrix();
}
solidsShader.useProgram(gl, false);
transparentsShader.useProgram(gl, true);
it = this.glChunkTable.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Vector3i, GLChunk> entry = it.next();
Vector3i position = entry.getKey();
GLChunk glChunk = entry.getValue();
if (glChunk == null || glChunk.buffer == null)
continue;
gl.glPushMatrix();
Vector2d hexPosition = new Vector2d();
HexGeometry.hexToCartesian(position.x, position.y, hexPosition);
gl.glTranslatef((float) (hexPosition.x * 16),
(float) (hexPosition.y * 16), position.z * 16);