Class SoPolygonOffset
- All Implemented Interfaces:
SafeDisposable
NOTE: SoPolygonOffset
, as its name implies, only works with polygonal geometry.
SoPolygonOffset
affects filled primitives such as SoFaceSet
and SoTriangleStripSet
. 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 as SoLineSet
and SoPointSet
cannot be offset with SoPolygonOffset()
. 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
and units
) 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:
-
Nested Class Summary
Nested ClassesNested 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
FieldsModifier and TypeFieldDescriptionfinal SoSFFloat
Specifies a scale factor that is used to create a variable depth offset for each polygon.final SoSFBool
Enables/disables polygon offset.A bit-wise combination of FILLED, LINES, and POINTS that determines which polygon modes should be offset.final SoSFFloat
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 -
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 Details
-
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
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
A bit-wise combination of FILLED, LINES, and POINTS that determines which polygon modes should be offset. Default = FILLED. -
on
Enables/disables polygon offset. Default = true.
-
-
Constructor Details
-
SoPolygonOffset
public SoPolygonOffset()Constructor.
-