org.proteinshader.graphics
Class Shape

java.lang.Object
  extended by org.proteinshader.graphics.Shape
Direct Known Subclasses:
Cylinder, ExtrudedShape, Sphere

public abstract class Shape
extends Object

Contains common methods needed by classes that draw geometric objects.


Field Summary
static double HALF_PI
          One-half Pi is defined as 1.57079632679489.
static double PI
          Pi is defined as 3.14159265358979.
static float[] SPECULAR_COLOR
          The material specular color is (0.95, 0.95, 0.95, 1.0).
static double TWO_PI
          2*Pi is defined as 6.28318530717958.
 
Constructor Summary
Shape()
          Constructor for use by subclasses.
 
Method Summary
 void deleteDisplayList(GL gl, int displayListName)
          Deletes an OpenGL display list.
 void executeDisplayList(GL gl, double scale, int displayListName)
          Executes an OpenGL display list and uniformly scales the geometric object.
 void executeDisplayList(GL gl, int displayListName)
          Executes an OpenGL display list.
 void setMaterial(GL gl, float red, float green, float blue, float alpha, float specularExp)
          Sets the material properties for the object about to be drawn.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PI

public static final double PI
Pi is defined as 3.14159265358979.

See Also:
Constant Field Values

TWO_PI

public static final double TWO_PI
2*Pi is defined as 6.28318530717958.

See Also:
Constant Field Values

HALF_PI

public static final double HALF_PI
One-half Pi is defined as 1.57079632679489.

See Also:
Constant Field Values

SPECULAR_COLOR

public static final float[] SPECULAR_COLOR
The material specular color is (0.95, 0.95, 0.95, 1.0).

Constructor Detail

Shape

public Shape()
Constructor for use by subclasses.

Method Detail

executeDisplayList

public void executeDisplayList(GL gl,
                               double scale,
                               int displayListName)
Executes an OpenGL display list and uniformly scales the geometric object.

Parameters:
gl - the current GL object.
scale - the scale factor for the sphere.
displayListName - the name (an integer) of an OpenGL display list.

executeDisplayList

public void executeDisplayList(GL gl,
                               int displayListName)
Executes an OpenGL display list.

Parameters:
gl - the current GL object.
displayListName - the name (an integer) of an OpenGL display list.

deleteDisplayList

public void deleteDisplayList(GL gl,
                              int displayListName)
Deletes an OpenGL display list. If a display list is no longer needed, its memory on the graphics card should be freed up by calling this method. If the name given as an argument does not correspond to an existing display list, it is simply ignored.

Parameters:
displayListName - the name (an integer) of an OpenGL display list.

setMaterial

public void setMaterial(GL gl,
                        float red,
                        float green,
                        float blue,
                        float alpha,
                        float specularExp)
Sets the material properties for the object about to be drawn.

The ambient and diffuse color of the material will be set to the colors given as arguments. The specular color is set to the default value for Shape.

Parameters:
gl - the current GL object.
red - component of RGBA color
green - component of RGBA color
blue - component of RGBA color
alpha - component of RGBA color
specularExp - the specular exponent for Phong lighting calculations.


Copyright © 2007-2008