org.proteinshader.graphics.displaylists
Class GeometricListInfo

java.lang.Object
  extended by org.proteinshader.graphics.displaylists.GeometricListInfo
Direct Known Subclasses:
CylinderListInfo, SegmentListInfo, SphereListInfo

public abstract class GeometricListInfo
extends Object

The concrete subclasses of this abstract class are used to store information on an OpenGL display list that hold the commands to draw a geometric object. A GeometricListInfo object is only for storing information on an OpenGL display list. The code to actually create an OpenGL display list in graphics card memory is in Shape subclasses such as Sphere or Cylinder.

An OpenGL display list is a set of OpenGL commands (and the numbers plugged into them) that is saved in memory on the graphics card. If many copies of the same object are used in a scene, the use of a display list can result in dramatically faster rendering.

A valid name (an integer) for a list is obtained by calling glGenLists(), and then asking the graphics card to remember all OpenGL commands issued between glNewList() and glEndList(). The following is an example of how a display list is created:

int displayListName = gl.glGenLists( 1 );

gl.glNewList( displayListName, GL.GL_COMPILE );
sphere.draw( gl, radius, slices, stacks );
gl.glEndList();


The display list can be executed later using glCallList():

gl.glPushMatrix();
gl.glScaled( scale, scale, scale );
gl.glCallList( displayListName );
gl.glPopMatrix();


If a display list is no longer needed, its memory can be freed up using:

gl.glDeleteLists( displayListName, 1 )


Constructor Summary
GeometricListInfo()
          Constructs a GeometricListInfo.
GeometricListInfo(int displayListName, StyleEnum style)
          Constructs a GeometricListInfo.
 
Method Summary
 int getDisplayListName()
          Returns the name of the OpenGL display list that this GeometricListInfo object stores information on.
 StyleEnum getStyle()
          Returns the style that the geometric object is intended for: SPACE_FILLING, BALLS_AND_STICKS, or STICKS.
 void setDisplayListName(int displayListName)
          Sets the name of the OpenGL display list that this GeometricListInfo object stores information on.
 void setStyle(StyleEnum style)
          Sets the style that this geometric object is intended for: SPACE_FILLING, BALLS_AND_STICKS, or STICKS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometricListInfo

public GeometricListInfo()
Constructs a GeometricListInfo. The name is set to zero and the style is set to null.


GeometricListInfo

public GeometricListInfo(int displayListName,
                         StyleEnum style)
Constructs a GeometricListInfo. The "name" that OpenGL gives to display list objects (stored on the graphics card) is actually an integer. The style argument explains whether the geometric object is intended to be used in a SPACE_FILLING, BALLS_AND_STICKS, or STICKS representation of the protein

Parameters:
displayListName - the name (an integer) of an OpenGL display list.
style - the style as a StyleEnum.
Method Detail

getDisplayListName

public int getDisplayListName()
Returns the name of the OpenGL display list that this GeometricListInfo object stores information on.

Returns:
The name (an integer) of the OpenGL display list.

setDisplayListName

public void setDisplayListName(int displayListName)
Sets the name of the OpenGL display list that this GeometricListInfo object stores information on.

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

getStyle

public StyleEnum getStyle()
Returns the style that the geometric object is intended for: SPACE_FILLING, BALLS_AND_STICKS, or STICKS.

Returns:
The style as a StyleEnum.

setStyle

public void setStyle(StyleEnum style)
Sets the style that this geometric object is intended for: SPACE_FILLING, BALLS_AND_STICKS, or STICKS.

Parameters:
style - the style as a StyleEnum.


Copyright © 2007-2008