PDA

View Full Version : a slow down problem



06-11-2004, 04:41 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;
---draw a sphere;
---glTranslate (to move the 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 :( why ? maybe other codes in the program have some unknow effect...
Is anyone have experienced such situation and could you please tell me what usually cause this?
Thank you.

Aeluned
06-11-2004, 04:48 AM
probably just an error in your post, but you need to do the translate *before* you draw your sphere, not afterwards. The translate you have now accomplishes nothing.

anyway, what are you basing your translation on (i.e. what are you passing as your values to translate)?

perhaps these values are approaching some limit as your timer keeps ticking???

hard to say from what you have posted there.

zhang ziqing
06-11-2004, 05:37 AM
thank you for information ,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 ?