java - OPENGL ES 2.0 texture in circle -
trying load texture circle, have big troubles it. original texture:
here's code:
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 = 0; < 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; }
and getting this: my result
what doing wrong? thank you
Comments
Post a Comment