OpenGL animation in wxWindows

I am doing some animation using OpenGL, wxWindows and Dev-C++.

I initially started this project using VC++ as a console application (Windows environment). I used GLUT and the animation was all fine in console in VC++ - I used a key press to play/pause the animation without problem. So, this confirm the animation works.

Now, I need to give this program GUI and decided to learn wxWindows. Also decided to learn to develop in Dev-C++. This time I use a button press to play/pause (toggle by same button) the animation. Problem: after pressing the button, the animation run and stop half way even i didn’t press the pause (same) button. Pressing the button again will cause the animation to continue another half, and so on. I suspected the problem with the button event handler. Couldn’t find any problem. So I used a simpler animation and it worked with the button (can play/pause).

The animation was tested ok on VC++ so shouldn’t b the problem. To further confirm, I used if (true) instead of the variable being changed by the button. The animation runs ok now (wxWindows and Dev-C++). When put back to use the button - problem of stopping half way. But the button works if doing simpler animation (i.e. only rotating certain part of the animation), i.e. event handler should b ok. Sigh, both seems ok but they are not ok. I am exhausted.

Can any one help?

As you haven’t posted any code, I can only guess… perhaps your animation counter code is buggy? Are you clamping the frame nr correctly?

Thermo

Hi Thermo,
Thanks for the response. I appreciated. The problem was due to incorrect declaration of an array. I am surprised that VC++ can tolerate this.
Regards
Hong