zhang ziqing

06-11-2004, 06:43 AM

I encountered a strange problem when i use glTranslate function to make a sphere to move by setting a timer. My idea is very simple :

.....

---set a "SetTimer(1,10,NULL)";

---caculate the position of the sphere(x,y,z);

---glPushMatrix;

---glTranslate (to move the sphere);

---draw a sphere;

---glPopMratrix;

......

at first the sphere moves well, but the things is that after a few minutes it slow down gradually ,I extend the time alternation "SetTimer(1,20,NULL)",I find the CPU utility was declined ,but it still slow down after a bit more minutes

yes, every time the position values(x,y,z) are got after a certain calculation , but I change the parameters to let it move in acircle ,so there are no values reach any limits ,I think if it moves well at first,it will certainly moves on well, but it still slow down;

And I make it move in a circle by using glRotation ( without position calculation) and find it moves well without any slow down ;

does this problem lies in the calculation or the working difference between glTranslation and glRotation ?

.....

---set a "SetTimer(1,10,NULL)";

---caculate the position of the sphere(x,y,z);

---glPushMatrix;

---glTranslate (to move the sphere);

---draw a sphere;

---glPopMratrix;

......

at first the sphere moves well, but the things is that after a few minutes it slow down gradually ,I extend the time alternation "SetTimer(1,20,NULL)",I find the CPU utility was declined ,but it still slow down after a bit more minutes

yes, every time the position values(x,y,z) are got after a certain calculation , but I change the parameters to let it move in acircle ,so there are no values reach any limits ,I think if it moves well at first,it will certainly moves on well, but it still slow down;

And I make it move in a circle by using glRotation ( without position calculation) and find it moves well without any slow down ;

does this problem lies in the calculation or the working difference between glTranslation and glRotation ?