org.proteinshader.gui.utils
Class FpsLabel

java.lang.Object
  extended by org.proteinshader.gui.utils.FpsLabel

public class FpsLabel
extends Object

Knows how to print a frames per second label (such as 'fps = 120') on the canvas.

This class uses GLFont2.java, which is a modified version of the original GLFont2 program written by Brad Fish (in C++). GLFont2.java is found in the separate glFont2.jar file, and the copyright notice and terms of use for GLFont2 are in the glFont2.html file that is found at the same level as the glFont2.jar file. A copy of the original glfont2.cpp and glfont2.h files are included inside the\ glFont2.jar file, along with a copy of the glFont2.html file with the copyright and terms of use notice. The glfont.exe executable (for creating '.glf' files) is also in the jar file (but it will only run on machines with the windows operating system).


Field Summary
static String FONT_DIRECTORY
          Stores the location of the fonts director.
static String FONT_FILE
          Stores the name of the fps font file.
 
Constructor Summary
FpsLabel(StructureToGraphics graphics)
          Constructs an FpsLabel object.
 
Method Summary
 void readFontFile(GL gl)
          Reads the fpsfont.glf file and stores an OpenGL texture object with the characters to be used for printing frames per second on the canvas during an animation.
 void write(GL gl, GLAutoDrawable canvas, double fps)
          Updates the frames per second display on the canvas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FONT_DIRECTORY

public static final String FONT_DIRECTORY
Stores the location of the fonts director.

See Also:
Constant Field Values

FONT_FILE

public static final String FONT_FILE
Stores the name of the fps font file. Currently, ArialBold18.glf is used.

See Also:
Constant Field Values
Constructor Detail

FpsLabel

public FpsLabel(StructureToGraphics graphics)
Constructs an FpsLabel object.

Parameters:
graphics - needed for setting a texture and shader.
Method Detail

readFontFile

public void readFontFile(GL gl)
                  throws glFont2.FontReaderException
Reads the fpsfont.glf file and stores an OpenGL texture object with the characters to be used for printing frames per second on the canvas during an animation.

Parameters:
gl - the current GL object.
Throws:
glFont2.FontReaderException

write

public void write(GL gl,
                  GLAutoDrawable canvas,
                  double fps)
Updates the frames per second display on the canvas.

Parameters:
gl - the current GL object.
canvas - the canvas to draw on.
fps - the number of frames per second.


Copyright © 2007-2008