private Grid generateWeightedGrid(GL gl) { final int uSteps = 20; final int vSteps = 20; float radius = 0.25f; float height = 2.0f; Grid grid = new Grid(uSteps + 1, vSteps + 1); for (int j = 0; j <= vSteps; j++) { for (int i = 0; i <= uSteps; i++) { double angle = Math.PI * 2 * i / uSteps; float x = radius * (float) Math.cos(angle); float y = height * ((float) j / vSteps - 0.5f); float z = radius * (float) Math.sin(angle); float u = -4.0f * (float) i / uSteps; float v = -4.0f * (float) j / vSteps; float w0 = (float) j / vSteps; float w1 = 1.0f - w0; grid.set(i, j, x, y, z, u, v, w0, w1, 0, 1); } } grid.createBufferObjects(gl); return grid; } }
private Grid generateWeightedGrid(GL gl) { final int uSteps = 20; final int vSteps = 20; float radius = 0.25f; float height = 2.0f; Grid grid = new Grid(uSteps + 1, vSteps + 1); for (int j = 0; j <= vSteps; j++) { for (int i = 0; i <= uSteps; i++) { double angle = Math.PI * 2 * i / uSteps; float x = radius * (float) Math.cos(angle); float y = height * ((float) j / vSteps - 0.5f); float z = radius * (float) Math.sin(angle); float u = -4.0f * (float) i / uSteps; float v = -4.0f * (float) j / vSteps; float w0 = (float) j / vSteps; float w1 = 1.0f - w0; grid.set(i, j, x, y, z, u, v, w0, w1, 0, 1); } } grid.createBufferObjects(gl); return grid; } }