Top Description Fields Constructors Methods
jogamp.opengl.glu

public Class GLUquadricImpl

extends Object
implements GLUquadric
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.glu.GLUquadric
Imports
com.jogamp.opengl.GL, com.jogamp.opengl.glu.GLU, .GLUquadric, com.jogamp.opengl.math.FloatUtil, com.jogamp.opengl.util.ImmModeSink, com.jogamp.opengl.util.glsl.ShaderState

GLUquadricImpl.java Created 22-dec-2003 (originally Quadric.java)
Authors
Erik Duijs, Kenneth Russell, Sven Gothel

Field Summary

Modifier and TypeField and Description
private static final int
private int
public GL
private ImmModeSink
private boolean
private boolean
private int
public int
private int
private static final float
private static final float
public int
public ShaderState
private boolean
public static final boolean
public static final boolean
private final boolean

Constructor Summary

AccessConstructor and Description
public
GLUquadricImpl(final GL gl, final boolean useGLSL, final ShaderState st, final int shaderProgram)

Method Summary

Modifier and TypeMethod and Description
private float
cos(final float r)

public void
drawCylinder(final GL gl, final float
Specifies the radius of the cylinder at z = 0.
baseRadius
,
final float
Specifies the radius of the cylinder at z = height.
topRadius
,
final float
Specifies the height of the cylinder.
height
,
final int
Specifies the number of subdivisions around the z axis.
slices
,
final int
Specifies the number of subdivisions along the z axis.
stacks
)

draws a cylinder oriented along the z axis.

public void
drawDisk(final GL gl, final float innerRadius, final float outerRadius, final int slices, final int loops)

renders a disk on the z = 0 plane.

public void
drawPartialDisk(final GL gl, final float innerRadius, final float outerRadius, int slices, final int loops, float startAngle, float sweepAngle)

renders a partial disk on the z=0 plane.

public void
drawSphere(final GL gl, final float radius, final int slices, final int stacks)

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

public void
public int

Returns:

int
getDrawStyle
()

Returns the drawStyle.

public boolean
public int

Returns:

int
getNormals
()

Returns the normals.

public int

Returns:

int
getOrientation
()

Returns the orientation.

public boolean

Returns:

boolean
getTextureFlag
()

Returns the textureFlag.

private final void
glBegin(final GL gl, final int mode)

private final void
glEnd(final GL gl)

private final void
glNormal3f(final GL gl, final float x, final float y, final float z)

private final void
glNormal3f_b(final GL gl, final float x, final float y, final float z)

private final void
glNormal3f_s(final GL gl, final float x, final float y, final float z)

private final void
glTexCoord2f(final GL gl, final float x, final float y)

private final void
glVertex2f(final GL gl, final float x, final float y)

private final void
glVertex3f(final GL gl, final float x, final float y, final float z)

public boolean
private void
normal3f(final GL gl, float x, float y, float z)

Call glNormal3f after scaling normal to unit length.

public ImmModeSink
public void
public void
setDrawStyle(final int
The drawStyle to set
drawStyle
)

specifies the draw style for quadrics.

public void
public void
setNormals(final int
The normals to set
normals
)

specifies what kind of normals are desired for quadrics.

public void
setOrientation(final int
The orientation to set
orientation
)

specifies what kind of orientation is desired for.

public void
setTextureFlag(final boolean
The textureFlag to set
textureFlag
)

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

private float
sin(final float r)

private final void
TXTR_COORD(final GL gl, final float x, final float y)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CACHE_SIZEback to summary
private static final int CACHE_SIZE
drawStyleback to summary
private int drawStyle
glback to summary
public GL gl
immModeSinkback to summary
private ImmModeSink immModeSink
immModeSinkEnabledback to summary
private boolean immModeSinkEnabled
immModeSinkImmediateback to summary
private boolean immModeSinkImmediate
normalsback to summary
private int normals
normalTypeback to summary
public int normalType
orientationback to summary
private int orientation
PIback to summary
private static final float PI
PI_2back to summary
private static final float PI_2
shaderProgramback to summary
public int shaderProgram
shaderStateback to summary
public ShaderState shaderState
textureFlagback to summary
private boolean textureFlag
USE_NORMback to summary
public static final boolean USE_NORM
USE_TEXTback to summary
public static final boolean USE_TEXT
useGLSLback to summary
private final boolean useGLSL

Constructor Detail

GLUquadricImplback to summary
public GLUquadricImpl(final GL gl, final boolean useGLSL, final ShaderState st, final int shaderProgram)

Method Detail

cosback to summary
private float cos(final float r)
drawCylinderback to summary
public void drawCylinder(final GL gl, final float baseRadius, final float topRadius, final float height, final int slices, final int stacks)

draws a cylinder oriented along the z axis. The base of the cylinder is placed at z = 0, and the top at z=height. Like a sphere, a cylinder is subdivided around the z axis into slices, and along the z axis into stacks. Note that if topRadius is set to zero, then this routine will generate a cone. If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then any generated normals point away from the z axis. Otherwise, they point toward the z axis. If texturing is turned on (with glu.quadricTexture), then texture coordinates are generated so that t ranges linearly from 0.0 at z = 0 to 1.0 at z = height, 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.

Parameters
baseRadius:float

Specifies the radius of the cylinder at z = 0.

topRadius:float

Specifies the radius of the cylinder at z = height.

height:float

Specifies the height of the cylinder.

slices:int

Specifies the number of subdivisions around the z axis.

stacks:int

Specifies the number of subdivisions along the z axis.

drawDiskback to summary
public void drawDisk(final GL gl, final float innerRadius, final float outerRadius, final int slices, final int loops)

renders a disk on the z = 0 plane. The disk has a radius of outerRadius, and contains a concentric circular hole with a radius of innerRadius. If innerRadius is 0, then no hole is generated. The disk is subdivided around the z axis into slices (like pizza slices), and also about the z axis into rings (as specified by slices and loops, respectively). With respect to orientation, the +z side of the disk is considered to be "outside" (see glu.quadricOrientation). This means that if the orientation is set to GLU.OUTSIDE, then any normals generated point along the +z axis. Otherwise, they point along the -z axis. If texturing is turned on (with glu.quadricTexture), texture coordinates are generated linearly such that where r=outerRadius, the value at (r, 0, 0) is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at (0, -r, 0) it is (0.5, 0).

drawPartialDiskback to summary
public void drawPartialDisk(final GL gl, final float innerRadius, final float outerRadius, int slices, final int loops, float startAngle, float sweepAngle)

renders a partial disk on the z=0 plane. A partial disk is similar to a full disk, except that only the subset of the disk from startAngle through startAngle + sweepAngle is included (where 0 degrees is along the +y axis, 90 degrees along the +x axis, 180 along the -y axis, and 270 along the -x axis). The partial disk has a radius of outerRadius, and contains a concentric circular hole with a radius of innerRadius. If innerRadius is zero, then no hole is generated. The partial disk is subdivided around the z axis into slices (like pizza slices), and also about the z axis into rings (as specified by slices and loops, respectively). With respect to orientation, the +z side of the partial disk is considered to be outside (see gluQuadricOrientation). This means that if the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point along the +z axis. Otherwise, they point along the -z axis. If texturing is turned on (with gluQuadricTexture), texture coordinates are generated linearly such that where r=outerRadius, the value at (r, 0, 0) is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at (0, -r, 0) it is (0.5, 0).

drawSphereback to summary
public void drawSphere(final GL gl, final float radius, final int slices, final 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.

enableImmModeSinkback to summary
public void enableImmModeSink(final boolean val)

Implements com.jogamp.opengl.glu.GLUquadric.enableImmModeSink.

Annotations
@Override
getDrawStyleback to summary
public int getDrawStyle()

Returns the drawStyle.

Returns:int

int

getImmModeback to summary
public boolean getImmMode()

Implements com.jogamp.opengl.glu.GLUquadric.getImmMode.

Annotations
@Override
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

glBeginback to summary
private final void glBegin(final GL gl, final int mode)
glEndback to summary
private final void glEnd(final GL gl)
glNormal3fback to summary
private final void glNormal3f(final GL gl, final float x, final float y, final float z)
glNormal3f_bback to summary
private final void glNormal3f_b(final GL gl, final float x, final float y, final float z)
glNormal3f_sback to summary
private final void glNormal3f_s(final GL gl, final float x, final float y, final float z)
glTexCoord2fback to summary
private final void glTexCoord2f(final GL gl, final float x, final float y)
glVertex2fback to summary
private final void glVertex2f(final GL gl, final float x, final float y)
glVertex3fback to summary
private final void glVertex3f(final GL gl, final float x, final float y, final float z)
isImmModeSinkEnabledback to summary
public boolean isImmModeSinkEnabled()

Implements com.jogamp.opengl.glu.GLUquadric.isImmModeSinkEnabled.

Annotations
@Override
normal3fback to summary
private void normal3f(final GL gl, float x, float y, float z)

Call glNormal3f after scaling normal to unit length.

replaceImmModeSinkback to summary
public ImmModeSink replaceImmModeSink()

Implements com.jogamp.opengl.glu.GLUquadric.replaceImmModeSink.

Annotations
@Override
resetImmModeSinkback to summary
public void resetImmModeSink(final GL gl)

Implements com.jogamp.opengl.glu.GLUquadric.resetImmModeSink.

Annotations
@Override
setDrawStyleback to summary
public void setDrawStyle(final 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

setImmModeback to summary
public void setImmMode(final boolean val)

Implements com.jogamp.opengl.glu.GLUquadric.setImmMode.

Annotations
@Override
setNormalsback to summary
public void setNormals(final 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(final 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(final 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 float sin(final float r)
TXTR_COORDback to summary
private final void TXTR_COORD(final GL gl, final float x, final float y)