Hey Leute.
Ich wollte gerade einen Zylinder mit Opengl rendern. Dazu schrieb ich mir folgenden Algorithmus:
for(int xDivision = 0; xDivision < xDivisionCount; xDivision++){
float line[] = getVboLine(xDivision, yDivision, radius, height, xDivisionCount, yDivisionCount);
string.append(line[0] + ", " + line[1] + ", " + line[2] + ", " + line[3] + ", " + line[4] + ", ");
}
}
public float[] getVboLine(int xDivision, int yDivision, float radius, float height, int xDivisionCount, int yDivisionCount){
float xDegrees = 360.0f / xDivisionCount * xDivision;
float xRadian = (float) Math.toRadians(xDegrees);
float x = (float) Math.sin(xRadian) * radius;
float z = (float) Math.cos(xRadian) * radius;
float y = (float) yDivision * (height / (yDivisionCount - 1));
float s = xDegrees * (1.0f / 360.0f);
float t = yDivision * (1.0f / (yDivisionCount - 1));
return new float[]{
x, y, z, s, t
};
}```
Das Problem ist, das bei bestimmten inputs für xDivisionCount und yDivisionCount einfach ein Punkt im Mesh fehlt. Das sieht dann so aus, hier parameter: 200, 100:
Wenn ich das ganze mit Triangle Strips render ist halt ein loch im objekt...
woher kommt das? Gibts nen fehler im code?
Ach ja: Ich hab das ganze vor ein paar stunden auf SO gepostet, aber dort scheint niemand was zu wissen... [link](http://stackoverflow.com/questions/26086402/strange-thing-with-cylinder-algorithm?noredirect=1#comment40876082_26086402)