Class SoPolygonOffset
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoPolygonOffset
-
- All Implemented Interfaces:
SafeDisposable
public class SoPolygonOffset extends SoNode
Property node that sets the polygon offset. This class encapsulates the OpenGL 1.1 glPolygonOffset() function. This node can be used to offset polygons that are at the exact same depth to avoid depth buffer artifacts, commonly called z-buffer stitching.NOTE:
SoPolygonOffset
, as its name implies, only works with polygonal geometry.SoPolygonOffset
affects filled primitives such asSoFaceSet
andSoTriangleStripSet
. It also affects lines and points in the limited sense that it affects polygonal primitives when the draw style is set to LINES or POINTS. However, because polygon offset does not affect non-polygonal geometry, primitives such asSoLineSet
andSoPointSet
cannot be offset withSoPolygonOffset()
. To avoid depth buffer artifacts with mixed polygonal and non-polygonal geometry, you should "push" the polygonal geometry away from the camera.Note: There is only one offset value (combination of
factor
andunits
) in the traversal state at any given time.The value of the offset is factor * z + r *
units
, where
- z is a measurement of the change in depth relative to the screen area of the polygon (commonly called the depth slope), and
- r is the smallest value that is guaranteed to produce a resolvable offset for a given OpenGL implementation.
So units produces a constant depth offset and factor produces a variable depth offset which is zero when a polygon is perpendicular to the view vector (parallel to the view plane) and increases as the depth slope increases.
Both factor and units may be either positive or negative. A positive offset value pushes primitives away from the camera and a negative value pulls them closer. Generally a small value, like 1.0, is sufficient for both parameters.
File format/default:
PolygonOffset {
factor 1 units 100 styles FILLED on true Action behavior:
SoGLRenderAction
Calls glPolygonOffset and enables or disables the polygon offset feature as specified. Sets: SoPolyonOffsetElement.- See Also:
SoDepthOffset
,SoDepthBuffer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoPolygonOffset.StyleType
Offset style.-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFFloat
factor
Specifies a scale factor that is used to create a variable depth offset for each polygon.SoSFBool
on
Enables/disables polygon offset.SoSFBitMask<SoPolygonOffset.StyleType>
styles
A bit-wise combination of FILLED, LINES, and POINTS that determines which polygon modes should be offset.SoSFFloat
units
Is multiplied by an OpenGL implementation-specific value to create a constant depth offset.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoPolygonOffset()
Constructor.
-
Method Summary
-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
factor
public final SoSFFloat factor
Specifies a scale factor that is used to create a variable depth offset for each polygon. Positive values push polygons away from the camera (opposite ofSoDepthOffset
). Default = 1.0.
-
units
public final SoSFFloat units
Is multiplied by an OpenGL implementation-specific value to create a constant depth offset. Positive values push polygons away from the camera (oppsite ofSoDepthOffset
). Default = 100.0.
-
styles
public final SoSFBitMask<SoPolygonOffset.StyleType> styles
A bit-wise combination of FILLED, LINES, and POINTS that determines which polygon modes should be offset. Default = FILLED.
-
on
public final SoSFBool on
Enables/disables polygon offset. Default = true.
-
-