## 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

1. void shape::addCircle(float radius,glm::vec2 pos,int numVer)
2. {
3. //Add the first vertice and the center of the circle
4. vec.push_back(vertex(pos, pos, glm::vec3(0, 0, 0)));
5. //Add the first vertice to count vertices
6. countVertice++;
7. //Index for glDrawElements.
8. //We send GL_TRIANGLE_FAN
9. vector<GLuint> index;
10. //here we take the number of vertices wanted and we multiply it by 3 because the circle is made with triangle
11. int Vertice = 3 * numVer;
12. //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
13. float spriteRadius = 180 * (radius / 90);
14. //pi
15. float pi = 3.1415926f;
16. //loops throught all of the vertices + 1 because we need a last vertices for the last triangle
17. for (int i = 0; i <= Vertice+1; i++)
18. {
19. //same as we do for the loop
20. indexs.push_back(countVertice+ i);
21. //operation for the circle
22. float ope = 2*pi * i / Vertice;
23. //We add it to a vector and the vector gonna be send to the gpu
24. 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)));
25. //Adding the vertice
26. countVertice++;
27. }
28. }

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