float rw = radius/width;
//left center
vertices[0] = ref.clone();
texCoord[0] = new Vector2f(0.5f, rw);
// 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((x * 0.5f) + 0.5f, rw-(z * rw));
System.out.println(texCoord[verticesBase]);
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();
float rbw = (width-radius)/width;
texCoord[base2] = new Vector2f(0.5f, rbw);
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((x * 0.5f) + 0.5f, 1 - (z * rw));
if (lastPoint > 0) {
indices[indicesBase] = base2;
indices[indicesBase+1] = verticesBase;
indices[indicesBase+2] = lastPoint;
}