Property node that sets the polygon offset. More...
#include <Inventor/nodes/SoPolygonOffset.h>
Public Types | |
enum | Style { FILLED = SoPolygonOffsetElement::FILLED, LINES = SoPolygonOffsetElement::LINES, POINTS = SoPolygonOffsetElement::POINTS } |
Public Member Functions | |
virtual SoType | getTypeId () const |
SoPolygonOffset () | |
virtual void | setOverride (const SbBool state) |
virtual SbBool | isOverride () const |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Public Attributes | |
SoSFFloat | factor |
SoSFFloat | units |
SoSFBitMask | styles |
SoSFBool | on |
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 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
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.
factor | 1 |
units | 100 |
styles | FILLED |
on | TRUE |
SoPolygonOffset::SoPolygonOffset | ( | ) |
Constructor.
static SoType SoPolygonOffset::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoNode.
virtual SoType SoPolygonOffset::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoNode.
virtual SbBool SoPolygonOffset::isOverride | ( | ) | const [inline, virtual] |
Returns the state of the override field.
Reimplemented from SoNode.
virtual void SoPolygonOffset::setOverride | ( | const SbBool | state | ) | [inline, virtual] |
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 of SoDepthOffset). Default = 1.0.
Enables/disables polygon offset.
Default = TRUE.
A bit-wise combination of FILLED, LINES, and POINTS that determines which polygon modes should be offset.
Default = FILLED.
Is multiplied by an OpenGL implementation-specific value to create a constant depth offset.
Positive values push polygons away from the camera (oppsite of SoDepthOffset). Default = 100.0.