Maybe there are just typos in the code you’ve written here, but I guess the loop is at least very strange. It should better look like this, if I understand right what you want to do:
for(i=0; i<sides; i++) {
radi = ((2PI)/sides)i;
mx = radiuscos(radi);
my = radiussin(radi);
glVertex2f(mx, my);
}
I guess that it was the long way around but I wanted to use degree’s but maybe to simplify that routine I should just stick to rad.
Yea, I believe you got the idea of what I am trying ot do.
One other question is a triangle fan need’s a min. of 3 points, to create one triangle?
Originally posted by flashp:
[b]Maybe there are just typos in the code you’ve written here, but I guess the loop is at least very strange. It should better look like this, if I understand right what you want to do:
for(i=0; i<sides; i++) {
radi = ((2PI)/sides)i;
mx = radiuscos(radi);
my = radiussin(radi);
glVertex2f(mx, my);
}
Three points for the first triangle and one point for every triangle after that. The initial point (ex. 0) and the previous point (n-1) are used with the last point (n)
to create the next tri in the fan. Here’s a cheezy ascii diagram
1 2 3
\ | /|
\ | / |
0 __4
\ |
\ |
5
0 is the initial point, 4 is n-1, and 5 is n. Clear as mud??