SoPolygonOffset(3)
π SoPolygonOffset(3) β Coin's layering node, but make it cute π
okay bestie, welcome to the manual page for SoPolygonOffset(3). this is a Coin node. it's a node type for "layering" rendering primitives. yes, that's the entire concept. no cap. it's giving stacked primitives but make it fashion. π
πΈ NAME πΈ
SoPolygonOffset β the SoPolygonOffset class is a node type for "layering" rendering primitives.
β¨ SYNOPSIS β¨
#include <Inventor/nodes/SoPolygonOffset.h>
Inherits SoNode.
π Public Types π
okay so this class has one enum, and it's literally:
enum Style { FILLED = SoPolygonOffsetElement::FILLED, LINES = SoPolygonOffsetElement::LINES, POINTS = SoPolygonOffsetElement::POINTS }
that's it. FILLED, LINES, POINTS. periodt. π
π« Public Types inherited from SoNode π«
SoNode passed down this enum, and it's a whole timeline of Coin/Inventor versions. no cap:
enum NodeType { INVENTOR = 0x0000, VRML1 = 0x0001, VRML2 = 0x0002, INVENTOR_1 = 0x0004, INVENTOR_2_0 = 0x0008, INVENTOR_2_1 = 0x0010, INVENTOR_2_5 = 0x0020, INVENTOR_2_6 = 0x0040, COIN_1_0 = 0x0080, COIN_2_0 = 0x0100, EXTENSION = 0x0200, COIN_2_2 = 0x0400, COIN_2_3 = 0x0800, COIN_2_4 = 0x1000, INVENTOR_5_0 = 0x2000, COIN_2_5 = 0x4000, COIN_3_0 = 0x8000, INVENTOR_6_0 = 0x10000, COIN_4_0 = 0x20000 }
slay. that's every single one, and yes, we're keeping all the hex values. π
π¦ Public Member Functions π¦
these are the ones SoPolygonOffset brings to the group chat:
virtual SoType getTypeId (void) constβ gets the type id, obviously.SoPolygonOffset (void)β the constructor, bestie.virtual void doAction (SoAction *action)β does the action.virtual void callback (SoCallbackAction *action)β callback time.virtual void GLRender (SoGLRenderAction *action)β GL render, iconic.
π Public Member Functions inherited from SoNode π
these all come from SoNode, and there are a lot, so buckle up:
void setOverride (const SbBool state)SbBool isOverride (void) constvoid setNodeType (const NodeType type)NodeType getNodeType (void) constvirtual SoNode * copy (SbBool copyconnections=FALSE) constvirtual SbBool affectsState (void) constvirtual void GLRenderBelowPath (SoGLRenderAction *action)virtual void GLRenderInPath (SoGLRenderAction *action)virtual void GLRenderOffPath (SoGLRenderAction *action)virtual void getBoundingBox (SoGetBoundingBoxAction *action)virtual void getMatrix (SoGetMatrixAction *action)virtual void handleEvent (SoHandleEventAction *action)virtual void pick (SoPickAction *action)virtual void rayPick (SoRayPickAction *action)virtual void search (SoSearchAction *action)virtual void write (SoWriteAction *action)virtual void audioRender (SoAudioRenderAction *action)virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)virtual void grabEventsSetup (void)virtual void grabEventsCleanup (void)virtual void startNotify (void)virtual void notify (SoNotList *l)SbUniqueId getNodeId (void) constvirtual SoChildList * getChildren (void) constvirtual void writeInstance (SoOutput *out)virtual SoNode * addToCopyDict (void) constvirtual void copyContents (const SoFieldContainer *from, SbBool copyconnections)virtual SoFieldContainer * copyThroughConnection (void) const
that's the whole list. no skips. π
π Public Member Functions inherited from SoFieldContainer π
more inherited functions, and they're all here:
void setToDefaults (void)SbBool hasDefaultValues (void) constSbBool fieldsAreEqual (const SoFieldContainer *container) constvoid copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=FALSE)SbBool set (const char *const fielddata)void get (SbString &fielddata)virtual int getFields (SoFieldList &l) constvirtual int getAllFields (SoFieldList &l) constvirtual SoField * getField (const SbName &name) constvirtual SoField * getEventIn (const SbName &name) constvirtual SoField * getEventOut (const SbName &name) constSbBool getFieldName (const SoField *const field, SbName &name) constSbBool enableNotify (const SbBool flag)SbBool isNotifyEnabled (void) constSbBool set (const char *fielddata, SoInput *input)void get (SbString &fielddata, SoOutput *out)virtual SbBool validateNewFieldValue (SoField *field, void *newval)virtual void addWriteReference (SoOutput *out, SbBool isfromfield=FALSE)SbBool getIsBuiltIn (void) constvirtual void getFieldsMemorySize (size_t &managed, size_t &unmanaged) constvoid setUserData (void *userdata) constvoid * getUserData (void) const
yes, both set overloads and both get overloads are here. iykyk. π«Ά
π«Ά Public Member Functions inherited from SoBase π«Ά
and from SoBase, the final public function batch:
void ref (void) constvoid unref (void) constvoid unrefNoDelete (void) constint32_t getRefCount (void) constvoid touch (void)SbBool isOfType (SoType type) constβ ReturnsTRUEif the type of this object is either of the same type or inherited fromtype.virtual SbName getName (void) constvirtual void setName (const SbName &newname)void addAuditor (void *const auditor, const SoNotRec::Type type)void removeAuditor (void *const auditor, const SoNotRec::Type type)const SoAuditorList & getAuditors (void) constSbBool shouldWrite (void)void assertAlive (void) const
the isOfType description is literally the original one. keeping it. π
β Static Public Member Functions β
static SoType getClassTypeId (void)static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.
π Static Public Member Functions inherited from SoNode π
static uint32_t getCompatibilityTypes (const SoType &nodetype)static SoType getClassTypeId (void)static SoNode * getByName (const SbName &name)static int getByName (const SbName &name, SoNodeList &l)static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static void initClasses (void)static SbUniqueId getNextNodeId (void)static int getActionMethodIndex (const SoType type)static void getBoundingBoxS (SoAction *action, SoNode *node)static void GLRenderS (SoAction *action, SoNode *node)static void callbackS (SoAction *action, SoNode *node)static void getMatrixS (SoAction *action, SoNode *node)static void handleEventS (SoAction *action, SoNode *node)static void pickS (SoAction *action, SoNode *node)static void rayPickS (SoAction *action, SoNode *node)static void searchS (SoAction *action, SoNode *node)static void writeS (SoAction *action, SoNode *node)static void audioRenderS (SoAction *action, SoNode *node)static void getPrimitiveCountS (SoAction *action, SoNode *node)
πΈ Static Public Member Functions inherited from SoFieldContainer πΈ
static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static SoType getClassTypeId (void)β This static method returns theSoTypeobject associated with objects of this class.static void cleanupClass (void)static void initCopyDict (void)static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)static SoFieldContainer * checkCopy (const SoFieldContainer *orig)static SoFieldContainer * findCopy (const SoFieldContainer *orig, const SbBool copyconnections)static void copyDone (void)
π¦ Static Public Member Functions inherited from SoBase π¦
static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static SoType getClassTypeId (void)β This static method returns theSoTypeobject associated with objects of this class.static void addName (SoBase *const base, const char *const name)static void removeName (SoBase *const base, const char *const name)static void incrementCurrentWriteCounter (void)static void decrementCurrentWriteCounter (void)static SoBase * getNamedBase (const SbName &name, SoType type)static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)static SbBool read (SoInput *input, SoBase *&base, SoType expectedtype)static void setInstancePrefix (const SbString &c)static void setTraceRefs (SbBool trace)static SbBool getTraceRefs (void)static SbBool connectRoute (SoInput *input, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)static SbBool readRoute (SoInput *input)
π Public Attributes π
SoSFFloat factorSoSFFloat unitsSoSFBitMask stylesSoSFBool on
these are the public fields, bestie. π
π₯ Protected Member Functions π₯
virtual const SoFieldData * getFieldData (void) constvirtual ~SoPolygonOffset ()
π Protected Member Functions inherited from SoNode π
SoNode (void)virtual ~SoNode ()virtual SbBool readInstance (SoInput *in, unsigned short flags)
π Protected Member Functions inherited from SoFieldContainer π
SoFieldContainer (void)virtual ~SoFieldContainer ()
π§ Protected Member Functions inherited from SoBase π§
SoBase (void)virtual ~SoBase ()virtual void destroy (void)SbBool hasMultipleWriteRefs (void) constSbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) constvoid writeFooter (SoOutput *out) constvirtual const char * getFileFormatName (void) constvirtual SoNotRec createNotRec (void)
π Static Protected Member Functions π
static const SoFieldData ** getFieldDataPtr (void)
β¨ Static Protected Member Functions inherited from SoNode β¨
static const SoFieldData ** getFieldDataPtr (void)static void setNextActionMethodIndex (int index)static int getNextActionMethodIndex (void)static void incNextActionMethodIndex (void)static void setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask)
π Static Protected Member Functions inherited from SoBase π
static uint32_t getCurrentWriteCounter (void)static void staticDataLock (void)static void staticDataUnlock (void)
π¦ Additional Inherited Members π¦
π Protected Types inherited from SoBase π
enum BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }
π¬ Protected Attributes inherited from SoNode π¬
SbUniqueId uniqueId
π Protected Attributes inherited from SoFieldContainer π
SbBool isBuiltIn
π° Static Protected Attributes inherited from SoNode π°
static SbUniqueId nextUniqueId = 1static int nextActionMethodIndex = 0
okay bestie, that's part 1, and there's more coming. don't move. part 2 is loadingβ¦ πβ¨
π DETAILED DESCRIPTION π
okay so bestie, SoPolygonOffset is a node type for "layering" rendering primitives. like, making sure stuff stacks right. β¨
A common problem with real time 3D rendering systems is that rendered primitives which are at approximately the same depth with regard to the camera viewpoint will appear to flicker. I.e.: from one angle one primitive will appear to be closer, while at another angle, another primitive will appear closer. When this happens, the rendered graphics at that part of the scene will of course look a lot less visually pleasing. π
One common situation where this problem often occurs is when you attempt to put a wireframe grid as an outline on top of filled polygons.
The cause of the problem described above is that the z-buffer of any render system has a limited resolution, often at 16, 24 or 32 bits. Because of this, primitives which are close will sometimes get the same depth value in the z-buffer, even though they are not actually at the same depth-coordinate. π
To rectify the flickering problem, this node can be inserted in the scene graph at the proper place(s) to explicitly define how polygons, lines and/or points should be offset with regard to other primitives.
As for the details of how the SoPolygonOffset::factor and SoPolygonOffset::units should be set, we quote the OpenGL documentation:
The value of the offset isfactor * DZ + r * unitswhereDZis a measurement of the change in depth relative to the screen area of the polygon, andris the smallest value that is guaranteed to produce a resolvable offset for a given implementation. The offset is added before the depth test is performed and before the value is written into the depth buffer.
One word of notice with regard to the above quote from the OpenGL documentation: it doesn't really make sense to set "factor" and "units" to values with different signs, i.e. "factor" to a negative value and "units" to a positive value, or vice versa. π
The pixels would then be "pushed back" in Z-order by one part of the equation, but at the same time be "pushed forward" by the other part of the equation. This would most likely give very inconsistent results, but which may at first look OK.
We mention this potential for making a mistake, as it seems to be a quite common error.
Below is a simple, correct usage example:
#Inventor V2.1 ascii
Separator {
Coordinate3 { point [ -1 -1 0, 1 -1 0, 1 1 0, -1 1 0 ] }
Separator {
BaseColor { rgb 1 1 0 }
# needs to draw polygons-as-line, and not "real" lines -- see
# documentation below on why this is so:
DrawStyle { style LINES }
# draw two triangles, to get a line crossing the face of the
# polygon:
IndexedFaceSet { coordIndex [ 0, 1, 2, -1, 0, 2, 3 -1 ] }
}
PolygonOffset {
styles FILLED
factor 1.0
units 1.0
}
BaseColor { rgb 0 0.5 0 }
FaceSet { numVertices [ 4 ] }
}
Without the polygon offset node in the above example, the lines may look irregularly stippled with some graphics card drivers, as parts of it will show through the faceset, others not. This happens on seemingly random parts, as the z-buffer floating point calculations will be fickle with regard to whether or not the polygon or the line will be closer to the camera. π«
See the API documentation of the SoPolygonOffset::styles field below for a discussion of one important limitation of OpenGL's z-buffer offset mechanism: it only works with polygons or polygons rendered in line or point mode, using the SoDrawStyle::style field.
FILE FORMAT/DEFAULTS:
PolygonOffset {
factor 1
units 1
styles FILLED
on TRUE
}
Since π°οΈ
- TGS Inventor 2.5
- Coin 1.0
πΈ MEMBER ENUMERATION DOCUMENTATION πΈ
enum SoPolygonOffset::Style π
Enumeration of the rendering primitives which can be influenced by an SoPolygonOffset node.
Enumerator
FILLEDβ The polygon face should be offset.LINESβ The polygon edges should be offset.POINTSβ The polygon vertices should be offset.
π CONSTRUCTOR & DESTRUCTOR DOCUMENTATION π
SoPolygonOffset::SoPolygonOffset (void )
Constructor. hiiii she's born β¨
SoPolygonOffset::~SoPolygonOffset () [protected], [virtual]
Destructor. bye bestie π¦
π MEMBER FUNCTION DOCUMENTATION π
SoType SoPolygonOffset::getClassTypeId (void ) [static]
This static method returns the SoType object associated with objects of this class.
SoType SoPolygonOffset::getTypeId (void ) const [virtual]
Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and "downward" casting.
Implements SoBase.
const SoFieldData ** SoPolygonOffset::getFieldDataPtr (void ) [static], [protected]
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Returns the SoFieldData class which holds information about fields in this node.
const SoFieldData * SoPolygonOffset::getFieldData (void ) const [protected], [virtual]
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.
Reimplemented from SoFieldContainer.
void SoPolygonOffset::doAction (SoAction * action) [virtual]
This function performs the typical operation of a node for any action.
Reimplemented from SoNode.
void SoPolygonOffset::callback (SoCallbackAction * action) [virtual]
Action method for SoCallbackAction.
Simply updates the state according to how the node behaves for the render action, so the application programmer can use the SoCallbackAction for extracting information about the scene graph.
Reimplemented from SoNode.
void SoPolygonOffset::GLRender (SoGLRenderAction * action) [virtual]
Action method for the SoGLRenderAction.
This is called during rendering traversals. Nodes influencing the rendering state in any way or want to throw geometry primitives at OpenGL override this method.
Reimplemented from SoNode.
π MEMBER DATA DOCUMENTATION π
SoSFFloat SoPolygonOffset::factor
Offset multiplication factor. Scales the variable depth in the z-buffer of the rendered primitives.
See SoPolygonOffset's main class documentation above for detailed information on how the factor value is used.
Default value is 1.0.
SoSFFloat SoPolygonOffset::units
Offset translation multiplication factor. Will be multiplied with the value which represents the smallest discrete step that can be distinguished with the underlying z-buffer resolution.
See SoPolygonOffset's main class documentation above for detailed information on how the units value is used.
Note that positive values will push geometry "away" into the z-buffer, while negative values will "move" geometry closer.
Default value is 1.0.
SoSFBitMask SoPolygonOffset::styles
The rendering primitive type to be influenced by this node. This is a bitmask variable, so you can select several primitive types (out of filled polygons, lines and points) be influenced by the offset at the same time. π―
There is one very important OpenGL limitation to know about in this regard: z-buffer offsetting can only be done for either polygons, or for polygons rendered as lines or as points.
So attempts at using this node to offset e.g.SoLineSet/SoIndexedLineSetorSoPointSetprimitives will not work. π«
See the comments in the scene graph below for a detailed example on what SoPolygonOffset can and cannot do:
#Inventor V2.1 ascii
Separator {
# render polygon:
Coordinate3 { point [ -1.1 -1.1 0, 1.1 -1.1 0, 1.1 1.1 0, -1.1 1.1 0 ] }
BaseColor { rgb 0 0.5 0 }
FaceSet { numVertices [ 4 ] }
# offset polygon-as-lines to be in front of above polygon:
PolygonOffset {
styles LINES
factor -2.0
units 1.0
}
# render lines:
Coordinate3 { point [ -1 -1 0, 1 -1 0, 1 1 0, -1 1 0 ] }
BaseColor { rgb 1 1 0 }
Switch {
# change this to '0' to see how glPolygonOffset() does *not* work
# with "true" lines
whichChild 1
DEF child0 Group {
# can *not* be offset
IndexedLineSet { coordIndex [ 0, 1, 2, 3, 0, 2, -1, 1, 3 -1 ]
}
}
DEF child1 Group {
# will be offset
DrawStyle { style LINES }
FaceSet { numVertices [ 4 ] }
}
}
}
Field default value is SoPolygonOffset::FILLED.
SoSFBool SoPolygonOffset::on
Whether the offset is on or off. Default is for SoPolygonOffset::on to be TRUE.
π AUTHOR π
Generated automatically by Doxygen for Coin from the source code.
okay that's the whole thing bestie, you're SO welcome π this was version 4.0.10, dated Thu Jun 25 2026 00:00:00, and it lives at SoPolygonOffset(3) β go forth and slay your z-buffer β¨π
π¦ where this page comes from
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms