Thanks!
----- Original Message -----
From: "Alessandro Borges" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 16, 2002 6:01 AM
Subject: Re: [JAVA3D] Performance Experience
> From: "Zoran Krunic" <[EMAIL PROTECTED]>
> > Hi There,
> > Is there a way to get FPS measurements with j3D 1.2.1 ?
> > Thanks,
> > Zoran
>
> There is a generic way to count FPS: see below.
> May work with any version of Java3D.
> I dont remember the name of the author, but I like to say a
> big Thank You to him/her.
>
>
>
> /**
> * Title: FPS
> * Description: FPS measurer
> * Usage: add to your 3D graph and see the FPS measure at console
> * @author I dont know :(
> * @version 1.0
> */
>
> import javax.media.j3d.*;
> import com.sun.j3d.utils.geometry.Text2D;
> import javax.vecmath.*;
> import java.util.Enumeration;
>
> final class FPS extends Behavior {
>
> protected int nFrames;
> protected long startTime;
> protected final WakeupCondition w;
> protected static float frameRate;
> public int i=1;
> public Text2D text2D=null;
>
> public FPS(int nFrames)
> {
> this.nFrames = nFrames;
> w = new WakeupOnElapsedFrames(nFrames);
> }
>
> public FPS(){
> this(200);
> }
>
>
> public FPS(int nFrames, Shape3D texto)
> {
> this(nFrames);
> if (texto instanceof Text2D)
> text2D = (Text2D)texto;
>
> }
>
> public void initialize(){
> setSchedulingBounds (new BoundingSphere( new Point3d(), 1000));
> startTime = System.currentTimeMillis();
> wakeupOn(w);
> }
>
> public void processStimulus(Enumeration criteria){
> long time = System.currentTimeMillis();
> frameRate=1000 * (float)nFrames/(float)(time-startTime);
> String saida = new String("FPS : " + (int)frameRate);
> System.out.println(saida);
> if (text2D != null)
> {
> text2D.setString(saida);
> }
> startTime = System.currentTimeMillis();
>
> wakeupOn(w);
> }
>
> public static float getFrameRate() {
> return frameRate;
> }
> }
> _______________________________________________________________________
> Yahoo! Encontros
> O lugar certo para encontrar a sua alma g�mea.
> http://br.encontros.yahoo.com//
>
>
===========================================================================
> 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".
===========================================================================
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".