The Java3D Render Thread uses 100% of the CPU to maximize the frame rate.
But for the human eye it doesn't make a big difference if it's 25fps or
100fps. The CPU-Power is often needed for other calculations. So what do you
think of my suggestion of overriding the postSwap method of Canvas3D like
this:

    public final void postSwap()
    {
        long now=System.currentTimeMillis();

        frames++;
        float fps=frames/((now-last)/1000f);
        if(now>last+secs*1000)
        {
            if(last!=0) System.out.println(fps+" fps");
            last=now;
            frames=0;
        }
        if(fps>25)
        {
            try{Thread.sleep(20);}
            catch(Exception e) {}
        }
    }

My question is now: is it a good solution and is it okay to call sleep() at
all in postSwap?
It works fine on my system, and the CPU-Usage scales to the complexity of my
scene.

Markus Junginger

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to