尝试将纹理加载到圆圈中,但我遇到了很大麻烦。这是原始纹理:
以下是代码:
private void circle(){
int segments = 20;
vertices = new float[segments * 3+6];
texture = new float[segments * 3+6];
float angle = (float)(2*Math.PI/segments);
vertices[0]=0;
vertices[1]=0;
texture[0]=0.5f;
texture[1]=0.5f;
for(int i = 0; i < segments; i++){
vertices[3+(i*3)]=(float)Math.sin(angle * i)*0.7f;
vertices[3+(i*3+1)]=(float)Math.cos(angle*i)*0.7f;
texture[3+(i*3)]=(float)Math.sin(angle * i)*0.5f+0.5f;
texture[3+(i*3+1)]=(float)Math.cos(angle * i)*0.5f+0.5f;
}
vertices[3*segments+3]=0;
vertices[3*segments+4]=0.7f;
}
我得到的是这样的东西: my result
我做错了什么?谢谢