I have defined a disk with a triangle fan and I want to put a texture on it. Unfortunately, I can’t figure out how to define the texture coordinates.

Can anyone help me?

Thanks in advance for the time you will spend trying to help me.

I have defined a disk with a triangle fan and I want to put a texture on it. Unfortunately, I can’t figure out how to define the texture coordinates.

Can anyone help me?

Thanks in advance for the time you will spend trying to help me.

It depends on how you want to texture. Do you want to drap a square raster over the circle?

My texture image represents a circular picture and I want this circular area to be drawn on the surface of my disk. Let’s say I want to put the texture on both faces of a coin.

Then the center of your disk has UV if 0.5,0.5 and the other vertices lie on a circle where the vertex (radius,0,0) maps to UV (1,0.)

Sorry but I don’t understand your answer. :o

My disk is made of n triangles, and triangle i has the center of the disk as the first vertex, (radius*cos((i-1) a),radiussin((i-1)a)) as second vertex and (radius*cos(i

If my maths is right, the each vertex the uv will be( (cos((i-1)*a)+1)/2, (sin((i-1)a)+1)/2)

Then your math is wrong…

I don’t think so

```
double a = DEGREES2RADIANS(45);
float ox = 200;
float oy = 200;
float r = 100;
glBegin(GL_TRIANGLE_FAN);
glColor3f(0.5,.5f,0.0f);
glVertex3f(ox,oy,0);
for (int i = 0; i < 7; i++)
{
float u = (float(cos((i-1)*a))+1.0)/2.0;
float v = (float(sin((i-1)*a))+1.0)/2.0;
float cx = float(cos((i-1)*a)) * r;
float cy = float(sin((i-1)*a))* r;
glColor3f(u,v,0);
glVertex3f(cx+ox,cy+oy,0);
}
glEnd();
```