Hi Bob, As for your first question, here is a little piece of code I wrote to test instantaneous and average frame rate. It is a behavior that wakes up on every frame and calculates the amount of time that has passed. There are other ways to calculate frame rate (possibly more accurately) but this was simple. BTW, just add it to somewhere in the scene graph, ie: root.addChild(new FPS()); Evan -----Original Message----- From: Bob Gray <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Thursday, March 16, 2000 11:55 AM Subject: [JAVA3D] Basic Questions >1) I see people talk about the frame rate they can achieve. How do you > measure the frame rate in Java 3D? Is there some code you put some > place in your Java 3D program? If so, can someone post that code so I >can > determine my frame rate? > >2) What is meant by "full screen mode." I think I read someplace (here?) > that some opengl graphics cards only do hardware rendering when in "full >screen > mode". Does running the Java 3D program in an applet window mean it is >or is not > in full screen mode? How do you force a Java 3D program to render in > "full screen mode"?? > >3) I think someone here mentioned that when their Voodoo 3dfx 2000 card >switches to > full screen mode, there is a spinning 3dfx logo which appears for a >moment. > Is that true? (I never see this and I've always suspected that I never >really > get into full screen mode nor use the hardware opengl rendering of my >graphics card.) > >4) How do you tell if your graphics card is "turned on" and being used by >Java 3D? > (Particular the second part of the question: How do you *know* when Java >3D is > using hardware opengl rendering?) (I have a Voodoo 3 2000 card in case it >makes > a difference.) > > >Bob Gray > >=========================================================================== >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".
import javax.media.j3d.*; import javax.vecmath.*; class FPS extends Behavior { WakeupOnElapsedFrames FPSwakeup = new WakeupOnElapsedFrames(1); long lastMillis=0; // current time int curFrames = 0; // current elapsed frames long totalTime = 0; // total time long totalFrames = 0; // total frames public FPS() { setSchedulingBounds(new BoundingSphere(new Point3d(0,0,0),1000)); setEnable(true); } // Called to init the behavior public void initialize() { // Set the trigger for the interpolator wakeupOn(FPSwakeup); } // Called every time the behavior is activated public void processStimulus(java.util.Enumeration critera) { long curTime; long et; // See if any time has elapsed if (lastMillis==0) { lastMillis = System.currentTimeMillis(); wakeupOn(FPSwakeup); return; } totalFrames++; // Check current time, get elapsed time curTime = System.currentTimeMillis(); et = curTime - lastMillis; if (et >= 1000) { totalTime+=et; System.out.println((curFrames+1) + " frames in " + et + "ms Avg: " + ((float) 1000*totalFrames / totalTime) + " FPS"); lastMillis = curTime; curFrames=0; } else curFrames++; // Set the trigger for the interpolator wakeupOn(FPSwakeup); } }