任何人都可以帮助我在OpenGL-es android中绘制圆柱体。无论我画什么样的矩形。如何在Android上的OpenGL-es中绘制圆柱体?
我会很感激任何提示或链接。
下面是代码我已经试过:
int VERTICES=180; // more than needed
float coords[] = new float[VERTICES * 3];
float theta = 0;
for (int i = 0; i < VERTICES * 3; i += 3) {
coords[i + 0] = (float) Math.cos(theta);
coords[i + 1] = (float) Math.sin(theta);
coords[i + 2] = 0;
_vertexBuffer.put(coords[i + 0]);
_vertexBuffer.put(coords[i + 1]);
_vertexBuffer.put(coords[i + 2]);
theta += Math.PI/90;
}
这不包括绘制对象的GL ES调用。例如。 drawArrays或drawElements。你能否包括那部分? – andrewmu