Top Description Inners Fields Constructors Methods
org.lwjgl.test.opengles.util

public final Class Sphere

extends Object
Class Inheritance
Imports
java.nio.FloatBuffer, java.util.ArrayList, .List

VBO implementation of GLU Sphere.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private BufferObjectArray
private final List<Sphere.DrawCommand>
private int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private int
private int
pack-priv static final float
private boolean

Constructor Summary

AccessConstructor and Description
public
public
Sphere(final int drawStyle, final int orientation, final boolean textureFlag, final int normals)

public
Sphere(final float radius, final int slices, final int stacks)

public
Sphere(final float radius, final int slices, final int stacks, final int drawStyle, final int orientation, final boolean textureFlag, final int normals)

Method Summary

Modifier and TypeMethod and Description
private int
addDrawCommand(final int mode, final int first, final int count)

public void
bind()

private static float
cos(final float r)

public FloatBuffer
createBuffer(float radius, int slices, int stacks)

draws a sphere of the given radius centered around the origin.

public void
public void
draw()

public int

Returns:

int
getDrawStyle
()

Returns the drawStyle.

public int

Returns:

int
getNormals
()

Returns the normals.

public int

Returns:

int
getOrientation
()

Returns the orientation.

public boolean

Returns:

boolean
getTextureFlag
()

Returns the textureFlag.

public void
setDrawStyle(int
The drawStyle to set
drawStyle
)

specifies the draw style for quadrics.

public void
setNormals(int
The normals to set
normals
)

specifies what kind of normals are desired for quadrics.

public void
setOrientation(int
The orientation to set
orientation
)

specifies what kind of orientation is desired for.

public void
setTextureFlag(boolean
The textureFlag to set
textureFlag
)

specifies if texture coordinates should be generated for quadrics rendered with qobj.

private static float
sin(final float r)

public void
updateGeometry(final float radius, final int slices, final int stacks)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

boback to summary
private BufferObjectArray bo
drawCommandsback to summary
private final List<Sphere.DrawCommand> drawCommands
drawStyleback to summary
private int drawStyle
GLU_FILLback to summary
public static final int GLU_FILL
GLU_FLATback to summary
public static final int GLU_FLAT
GLU_INSIDEback to summary
public static final int GLU_INSIDE
GLU_LINEback to summary
public static final int GLU_LINE
GLU_NONEback to summary
public static final int GLU_NONE
GLU_OUTSIDEback to summary
public static final int GLU_OUTSIDE
GLU_POINTback to summary
public static final int GLU_POINT
GLU_SILHOUETTEback to summary
public static final int GLU_SILHOUETTE
GLU_SMOOTHback to summary
public static final int GLU_SMOOTH
normalsback to summary
private int normals
orientationback to summary
private int orientation
PIback to summary
pack-priv static final float PI
textureFlagback to summary
private boolean textureFlag

Constructor Detail

Sphereback to summary
public Sphere()
Sphereback to summary
public Sphere(final int drawStyle, final int orientation, final boolean textureFlag, final int normals)
Sphereback to summary
public Sphere(final float radius, final int slices, final int stacks)
Sphereback to summary
public Sphere(final float radius, final int slices, final int stacks, final int drawStyle, final int orientation, final boolean textureFlag, final int normals)

Method Detail

addDrawCommandback to summary
private int addDrawCommand(final int mode, final int first, final int count)
bindback to summary
public void bind()
cosback to summary
private static float cos(final float r)
createBufferback to summary
public FloatBuffer createBuffer(float radius, int slices, int stacks)

draws a sphere of the given radius centered around the origin. The sphere is subdivided around the z axis into slices and along the z axis into stacks (similar to lines of longitude and latitude).

If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then any normals generated point away from the center of the sphere. Otherwise, they point toward the center of the sphere.

If texturing is turned on (with glu.quadricTexture), then texture coordinates are generated so that t ranges from 0.0 at z=-radius to 1.0 at z=radius (t increases linearly along longitudinal lines), and s ranges from 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0 at the +y axis.

destroyback to summary
public void destroy()
drawback to summary
public void draw()
getDrawStyleback to summary
public int getDrawStyle()

Returns the drawStyle.

Returns:int

int

getNormalsback to summary
public int getNormals()

Returns the normals.

Returns:int

int

getOrientationback to summary
public int getOrientation()

Returns the orientation.

Returns:int

int

getTextureFlagback to summary
public boolean getTextureFlag()

Returns the textureFlag.

Returns:boolean

boolean

setDrawStyleback to summary
public void setDrawStyle(int drawStyle)

specifies the draw style for quadrics.

The legal values are as follows:

GLU.FILL: Quadrics are rendered with polygon primitives. The polygons are drawn in a counterclockwise fashion with respect to their normals (as defined with glu.quadricOrientation).

GLU.LINE: Quadrics are rendered as a set of lines.

GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges separating coplanar faces will not be drawn.

GLU.POINT: Quadrics are rendered as a set of points.

Parameters
drawStyle:int

The drawStyle to set

setNormalsback to summary
public void setNormals(int normals)

specifies what kind of normals are desired for quadrics. The legal values are as follows:

GLU.NONE: No normals are generated.

GLU.FLAT: One normal is generated for every facet of a quadric.

GLU.SMOOTH: One normal is generated for every vertex of a quadric. This is the default.

Parameters
normals:int

The normals to set

setOrientationback to summary
public void setOrientation(int orientation)

specifies what kind of orientation is desired for. The orientation values are as follows:

GLU.OUTSIDE: Quadrics are drawn with normals pointing outward.

GLU.INSIDE: Normals point inward. The default is GLU.OUTSIDE.

Note that the interpretation of outward and inward depends on the quadric being drawn.

Parameters
orientation:int

The orientation to set

setTextureFlagback to summary
public void setTextureFlag(boolean textureFlag)

specifies if texture coordinates should be generated for quadrics rendered with qobj. If the value of textureCoords is true, then texture coordinates are generated, and if textureCoords is false, they are not.. The default is false.

The manner in which texture coordinates are generated depends upon the specific quadric rendered.

Parameters
textureFlag:boolean

The textureFlag to set

sinback to summary
private static float sin(final float r)
updateGeometryback to summary
public void updateGeometry(final float radius, final int slices, final int stacks)
org.lwjgl.test.opengles.util back to summary

private Class Sphere.DrawCommand

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int
private int

Constructor Summary

AccessConstructor and Description
private
DrawCommand(final int mode, final int first, final int count)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
draw()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
private int count
firstback to summary
private int first
modeback to summary
private int mode

Constructor Detail

DrawCommandback to summary
private DrawCommand(final int mode, final int first, final int count)

Method Detail

drawback to summary
pack-priv void draw()