|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.graphics.Shape org.proteinshader.graphics.Cylinder
public class Cylinder
Knows how to draw a simple cylinder useful for representing the bonds between atoms. The cylinder can be capped with a small sphere at one or both ends. To speed up rendering, methods are provided for creating and using OpenGL display lists.
Field Summary | |
---|---|
static int |
MIN_CAP_TILING
The minumum tiling (number of slices and stacks) for a capping sphere is 3. |
static int |
MIN_SLICES
The minimum number of slices for a cylinder is 3. |
static int |
MIN_STACKS
The minimum number of stacks for a cylinder is 1. |
Fields inherited from class org.proteinshader.graphics.Shape |
---|
HALF_PI, PI, SPECULAR_COLOR, TWO_PI |
Constructor Summary | |
---|---|
Cylinder()
Constructs a Cylinder. |
Method Summary | |
---|---|
CylinderListInfo |
createDisplayList(GL gl,
CylinderListInfo info)
Creates an OpenGL display list for drawing a cylinder with the radii, slices, stacks, and end caps specified in the CylinderListInfo object given as an argument. |
int |
createDisplayList(GL gl,
double baseRadius,
double topRadius,
double height,
int slices,
int stacks,
boolean capBase,
boolean capTop,
int capSlices,
int capStacks)
Stores the OpenGL commands for drawing a cylinder as an OpenGL display list. |
void |
draw(GL gl,
double baseRadius,
double topRadius,
double height,
int slices,
int stacks,
boolean capBase,
boolean capTop,
int capSlices,
int capStacks)
Draws a cylinder oriented along the z-axis, with the base of the cylinder at the origin and the top of the cylinder at xyz = (0, 0, height). |
Methods inherited from class org.proteinshader.graphics.Shape |
---|
deleteDisplayList, executeDisplayList, executeDisplayList, setMaterial |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MIN_SLICES
public static final int MIN_STACKS
public static final int MIN_CAP_TILING
Constructor Detail |
---|
public Cylinder()
Method Detail |
---|
public CylinderListInfo createDisplayList(GL gl, CylinderListInfo info)
gl
- the current GL object.info
- a CylinderListInfo object with values for radius, slices, and
stacks.
public int createDisplayList(GL gl, double baseRadius, double topRadius, double height, int slices, int stacks, boolean capBase, boolean capTop, int capSlices, int capStacks)
gl
- the current GL object.baseRadius
- the radius of the base of the cylinder.topRadius
- the radius at the top of the cylinder.height
- the height of the cylinder.slices
- number of slices in the cylinder (at least 3).stacks
- number of stacks in the cylinder (at least 1).capBase
- determines if base is capped by a sphere.capTop
- determines if top is capped by a sphere.capSlices
- number of slices for cap sphere (at least 3).capStacks
- number of stacks for cap sphere (at least 3).
public void draw(GL gl, double baseRadius, double topRadius, double height, int slices, int stacks, boolean capBase, boolean capTop, int capSlices, int capStacks)
gl
- the current GL object.baseRadius
- radius of the base of the cylinder (usually 1).topRadius
- radius at the top of the cylinder (usually 1).height
- the height of the cylinder.slices
- the number of slices in the cylinder.stacks
- the number of stacks in the cylinder.capBase
- determines if base is capped by a sphere.capTop
- determines if top is capped by a sphere.capSlices
- number of slices for cap sphere (no less than 3).capStacks
- number of stacks for cap sphere (no less than 3).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |