float rw = radius/width;
float rbw = (width-radius)/width;
//left center
vertices[0] = ref.clone();
texCoord[0] = new Vector2f(rbw, 0.5f);
// draw left half circle
int lastPoint = 0;
for (int i = 0; i <= samples; i++) {
float x = FastMath.cos(angle);
float z = FastMath.sin(angle);
int verticesBase = i+1;
int indicesBase = (i-1)*3;
vertices[verticesBase] = new Vector3f((x * radius) + ref.x, ref.y, (z * radius) + ref.z);
texCoord[verticesBase] = new Vector2f(1-rw+(z * rw), (x * 0.5f) + 0.5f);
if (lastPoint > 0) {
indices[indicesBase] = 0;
indices[indicesBase+1] = verticesBase;
indices[indicesBase+2] = lastPoint;
}
lastPoint = verticesBase;
angle += rate;
}
// right center
ref.z = radius-width/2f;
int base2 = samples+2;
vertices[base2] = ref.clone();
texCoord[base2] = new Vector2f(rw, 0.5f);
angle = FastMath.PI;
lastPoint = 0;
// draw right half circle
for (int i = 0; i <= samples; i++) {
float x = FastMath.cos(angle);
float z = FastMath.sin(angle);
int verticesBase = i+samples+3;
int indicesBase = (i+samples)*3;
vertices[verticesBase] = new Vector3f((x * radius) + ref.x, ref.y, (z * radius) + ref.z);
texCoord[verticesBase] = new Vector2f(rw + (z * rw), (x * 0.5f) + 0.5f);
System.out.println(texCoord[verticesBase]);
if (lastPoint > 0) {
indices[indicesBase] = base2;
indices[indicesBase+1] = verticesBase;
indices[indicesBase+2] = lastPoint;