com.ryanm.glvisualiser.imp
Class Sphere

java.lang.Object
  extended by com.ryanm.glvisualiser.GLObject
      extended by com.ryanm.glvisualiser.imp.UniformObject
          extended by com.ryanm.glvisualiser.imp.Sphere
All Implemented Interfaces:
Configurable, ValueListener

public class Sphere
extends UniformObject

It's a sphere, centered on the origin, and with radius 1

Author:
ryanm

Field Summary
 
Fields inherited from class com.ryanm.glvisualiser.GLObject
dirty
 
Constructor Summary
Sphere(GLVisualiser drawable, GLMaterial material, int subdivisions)
          Standard constructor
 
Method Summary
protected  void constructGeometry(javax.media.opengl.GLAutoDrawable drawable)
          This method should be overridden with calls that draw the geometry of the object.
 int getSubdivisions()
          Gets the number of subdivisions in this sphere
 void setSubdivisions(int sub)
          Sets the number of vertical and horizontal subdivisions of the sphere.
 
Methods inherited from class com.ryanm.glvisualiser.imp.UniformObject
constructCompleteObject, getConfigurator, getConfigurator, getMaterial, setMaterial, valueChanged
 
Methods inherited from class com.ryanm.glvisualiser.GLObject
apply, drawGeometry, drawGeometry, finalize, isUsingLists, recompile, render, render, useLists
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sphere

public Sphere(GLVisualiser drawable,
              GLMaterial material,
              int subdivisions)
Standard constructor

Parameters:
drawable - The GL context to build in
material - The material to render the sphere with
subdivisions - The number of subdivisions. More = better looking/slower
Method Detail

constructGeometry

protected void constructGeometry(javax.media.opengl.GLAutoDrawable drawable)
Description copied from class: GLObject
This method should be overridden with calls that draw the geometry of the object. NB: It should not set any colour or material properties

Specified by:
constructGeometry in class GLObject
Parameters:
drawable - The GL/GLU context to use

setSubdivisions

public void setSubdivisions(int sub)
Sets the number of vertical and horizontal subdivisions of the sphere. More == nicer/slower, less == ugly/speedy. This will recompile the display lists, so don't do it too often.

Parameters:
sub - The number of subdivisions

getSubdivisions

public int getSubdivisions()
Gets the number of subdivisions in this sphere

Returns:
The number of vertical and horizontal subdivisions