# Strange circle texturing

Hello guys

I find a operation that can apply a texture on a circle and he do it well but i can figure out why it’s working

Here is the code

[HR][/HR][ol]
[/li][li]{
[/li][li] //Add the first vertice and the center of the circle
[/li][li] vec.push_back(vertex(pos, pos, glm::vec3(0, 0, 0)));
[/li][li] //Add the first vertice to count vertices
[/li][li] countVertice++;
[/li][li] //Index for glDrawElements.
[/li][li] //We send GL_TRIANGLE_FAN
[/li][li] vector<GLuint> index;
[/li][li] //here we take the number of vertices wanted and we multiply it by 3 because the circle is made with triangle
[/li][li] int Vertice = 3 * numVer;
[/li][li] //And here is the operation as i understand we take all of the angle of the triangle and we multuply it with the radius / right angle and as it’s seems he can do all the texture you want
[/li][li] float spriteRadius = 180 * (radius / 90);
[/li][li] //pi
[/li][li] float pi = 3.1415926f;
[/li][li] //loops throught all of the vertices + 1 because we need a last vertices for the last triangle
[/li][li] for (int i = 0; i <= Vertice+1; i++)
[/li][li] {
[/li][li] //same as we do for the loop
[/li][li] indexs.push_back(countVertice+ i);
[/li][li] //operation for the circle
[/li][li] float ope = 2*pi * i / Vertice;
[/li][li] //We add it to a vector and the vector gonna be send to the gpu
[/li][li] vec.push_back(vertex(glm::vec2(pos.x + (radius * cos(ope)), pos.y + (radius * sin(ope))), glm::vec2(cos(ope) * (radius/spriteRadius) + 0.5,sin(ope) * (radius / spriteRadius) + 0.5), glm::vec3(1, 1, 1)));
[/li][li] //Adding the vertice
[/li][li] countVertice++;
[/li][li] }
[/li][li]}[/ol]
[/li]That’s it
Thanks to all the people that help me to find why it work
Sorry for the code, he didn’t wanna space it