org.proteinshader.graphics.displaylists
Class SegmentReferences

java.lang.Object
  extended by org.proteinshader.graphics.displaylists.SegmentReferences

public class SegmentReferences
extends Object

Stores information on multiple OpenGL display lists that can be used for rendering Segments with different degrees of detail (this first version only holds one OpenGL display list for each Segment, but a future version will likely hold multiple OpenGL display lists for each Segment (with varying tiling number) so that the level of detail to be used can be calculated based on camera distance).

Whenever OpenGL display lists are cached for the Segments of a new Model, this class will need to clean up memory for any previously held OpenGL display lists (for Segments of a previous Model).


Constructor Summary
SegmentReferences()
          Constructs a SegmentReferences object.
 
Method Summary
 void cacheSegmentGeometry(GL gl, Model model, StyleEnum style)
          Caches an OpenGL display list for each Segment of each Region object in the Model.
 void cleanUpMemory(GL gl)
          Cleans up OpenGL graphics card memory allocated for OpenGL display lists for the previous Model.
 SegmentListInfo getSegmentListInfo(Segment segment)
          Returns the SegmentListInfo object that stores information on the OpenGL display lists that have been cached for the Segment given as an argument.
 void setAllStackNumbersToDefault()
          Sets all stacks numbers to the defaults defined in classes Tube and Ribbon (for loops, alpha-helices, and beta-strands).
 void setAlphaRibbonStacks(int stacks)
          Sets the number of stacks for drawing an alpha-helix as a ribbon.
 void setAlphaRibbonStacksToDefault()
          Sets the number of stacks for drawing an alpha-helix as a ribbon to the default value defined in class Ribbon.
 void setAlphaTubeStacks(int stacks)
          Sets the number of stacks for drawing an alpha-helix as a tube.
 void setAlphaTubeStacksToDefault()
          Sets the number of stacks for drawing an alpha-helix as a tube to the default value defined in class Tube.
 void setBetaRibbonStacks(int stacks)
          Sets the number of stacks for drawing a beta-strand as a ribbon.
 void setBetaRibbonStacksToDefault()
          Sets the number of stacks for drawing a beta-strand as a ribbon to the default value defined in class Ribbon.
 void setBetaTubeStacks(int stacks)
          Sets the number of stacks for drawing a beta-strand as a tube.
 void setBetaTubeStacksToDefault()
          Sets the number of stacks for drawing a beta-strand as a tube to the default value defined in class Tube.
 void setFrenetFramesShaders(ShaderManager shaders)
          Makes the ShaderManager object available for use in the FrenetFrames object.
 void setLoopRibbonStacks(int stacks)
          Sets the number of stacks for drawing a loop as a ribbon.
 void setLoopRibbonStacksToDefault()
          Sets the number of stacks for drawing a loop as a ribbon to the default value defined in class Ribbon.
 void setLoopTubeStacks(int stacks)
          Sets the number of stacks for drawing a loop as a tube.
 void setLoopTubeStacksToDefault()
          Sets the number of stacks for drawing a loop as a tube to the default value defined in class Tube.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SegmentReferences

public SegmentReferences()
Constructs a SegmentReferences object.

Method Detail

setFrenetFramesShaders

public void setFrenetFramesShaders(ShaderManager shaders)
Makes the ShaderManager object available for use in the FrenetFrames object. The ShaderManager is only needed because of an apparent bug on some Mac OS X machines where material color can only be set once after a custom shader is set, so to draw Frenet frames with more than one color, the shaders must be reset each time.

Parameters:
shaders - the shader manager object.

cacheSegmentGeometry

public void cacheSegmentGeometry(GL gl,
                                 Model model,
                                 StyleEnum style)
Caches an OpenGL display list for each Segment of each Region object in the Model.

This first version of this method will only cache a single OpenGL display list for each Segment object, but a future version might cache multiple display lists per Segment (with varying tiling numbers) so that the level of detail to use for a Segment could be varied with camera distance.

Parameters:
gl - the current GL object.
model - the current Model to cache Segments for.
style - the style (Tubes, Ribbons, or Frenet Frames).

getSegmentListInfo

public SegmentListInfo getSegmentListInfo(Segment segment)
Returns the SegmentListInfo object that stores information on the OpenGL display lists that have been cached for the Segment given as an argument.

If no OpenGL display lists have been cached for the Segment, then null is returned.

Parameters:
segment - the Segment to get a reference for.
Returns:
The SegmentListInfo object for the Segment.

cleanUpMemory

public void cleanUpMemory(GL gl)
Cleans up OpenGL graphics card memory allocated for OpenGL display lists for the previous Model.

Parameters:
gl - the current GL object.

setAllStackNumbersToDefault

public void setAllStackNumbersToDefault()
Sets all stacks numbers to the defaults defined in classes Tube and Ribbon (for loops, alpha-helices, and beta-strands).


setLoopTubeStacksToDefault

public void setLoopTubeStacksToDefault()
Sets the number of stacks for drawing a loop as a tube to the default value defined in class Tube. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.


setAlphaTubeStacksToDefault

public void setAlphaTubeStacksToDefault()
Sets the number of stacks for drawing an alpha-helix as a tube to the default value defined in class Tube. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.


setBetaTubeStacksToDefault

public void setBetaTubeStacksToDefault()
Sets the number of stacks for drawing a beta-strand as a tube to the default value defined in class Tube. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.


setLoopRibbonStacksToDefault

public void setLoopRibbonStacksToDefault()
Sets the number of stacks for drawing a loop as a ribbon to the default value defined in class Ribbon. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.


setAlphaRibbonStacksToDefault

public void setAlphaRibbonStacksToDefault()
Sets the number of stacks for drawing an alpha-helix as a ribbon to the default value defined in class Ribbon. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.


setBetaRibbonStacksToDefault

public void setBetaRibbonStacksToDefault()
Sets the number of stacks for drawing a beta-strand as a ribbon to the default value defined in class Ribbon. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.


setLoopTubeStacks

public void setLoopTubeStacks(int stacks)
Sets the number of stacks for drawing a loop as a tube. If the argument is less than 1, the number of stacks will be set to 1. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.

Parameters:
stacks - the number of stacks.

setAlphaTubeStacks

public void setAlphaTubeStacks(int stacks)
Sets the number of stacks for drawing an alpha-helix as a tube. If the argument is less than 1, the number of stacks will be set to 1. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.

Parameters:
stacks - the number of stacks.

setBetaTubeStacks

public void setBetaTubeStacks(int stacks)
Sets the number of stacks for drawing a beta-strand as a tube. If the argument is less than 1, the number of stacks will be set to 1. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.

Parameters:
stacks - the number of stacks.

setLoopRibbonStacks

public void setLoopRibbonStacks(int stacks)
Sets the number of stacks for drawing a loop as a ribbon. If the argument is less than 1, the number of stacks will be set to 1. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.

Parameters:
stacks - the number of stacks.

setAlphaRibbonStacks

public void setAlphaRibbonStacks(int stacks)
Sets the number of stacks for drawing an alpha-helix as a ribbon. If the argument is less than 1, the number of stacks will be set to 1. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.

Parameters:
stacks - the number of stacks.

setBetaRibbonStacks

public void setBetaRibbonStacks(int stacks)
Sets the number of stacks for drawing a beta-strand as a ribbon. If the argument is less than 1, the number of stacks will be set to 1. After setting this value, cacheSegmentGeometry() still needs to be called with the current GL object for the change to take effect.

Parameters:
stacks - the number of stacks.


Copyright © 2007-2008