How to limit frames in Java3D ?

So i need to limit the max number of frames in java3d to 30 then measure the amount of time i have left (in a second) to do other things.

Is there any easy way to do this ? With just a couple of lines of code ?

If this isn’t possible then if it is possible to measure in average the time it takes for a frame to complete (average of frames per seconds) it would do the trick I hope.

Yes. And no. It’s easy to do with a timer, but Windows has such a poor timer resolution that you can’t limit the frame rate exactly (things get a bit jerkey). The solution, is a native DLL for windows. All other OSes are ok. Go to:

http://java.dnsalias.com

and check out GAGETimer. A good frame limiting algo is also offered at the bottom of the page. Note that if you ever switch to LWJGL, it has its own high res timer.

OOps posted here by mistake. This thread was meant to be post in the java3d forum.