Class SoDrawStyle

  • All Implemented Interfaces:
    SafeDisposable

    public class SoDrawStyle
    extends SoNode
    Node that defines the style to use when rendering. This node defines the current drawing style for all subsequent shape nodes in a scene graph. SoDrawStyle specifies how primitives should be rendered.

    Draw style

    The drawing style has no effect on picking or callback primitive generation. In particular, geometry with style INVISIBLE is not rendered but is still pickable. It can be useful to put, for example, an invisible sphere around an assembly to ensure that it is always picked as a unit.

    Style INVISIBLE should generally not be used to "turn off" geometry. It is more efficient to put an SoSwitch node above the geometry and all its associated nodes. Using the Switch's whichChild field to "turn off" geometry avoids traversing any of the associated nodes.

    Point size and line width notes

    • The default point size and line width are both 0, which means to use the OpenGL default value (1 in both cases). Point size and line width valuess greater than zero are considered to be specified in printer's points, where 1 inch = 72 printer's points. However the default pixels-per-inch (managed by SbViewportRegion) is also 72. So effectively point size and line width are specified in pixels unless the application specifically sets a different pixels-per-inch value.
    • The maximum line width is hardware dependent. Only width 1 is guaranteed. An application could simulate wider lines using polygons if necessary.
    • If line antialiasing is disabled (which is the default), then OpenGL rounds the specified line width to the nearest integer. If rounding results in the value 0, it is as if the line width was set to 1.
    • When the specified point size and/or line width is greater than zero, the SoDrawStyle node will have a dependency on the SoViewportRegionElement (for the pixels-per-inch value). As a result render caches may be invalidated when the viewport size changes, e.g. if the drawing window is resized.

    File format/default:

    DrawStyle {

      style FILLED
      pointSize 0
      lineWidth 0
      linePattern 0xffff
      linePatternScaleFactor 1
    }

    Action behavior:

    SoGLRenderAction, SoCallbackAction
    Sets the current drawing style. Sets: SoDrawStyleElement, SoPointSizeElement, SoLineWidthElement, SoLinePatternElement.

    See Also:
    SoLightModel, SoPickStyle, SoShapeHints, SoColorMask
    • Field Detail

      • pointSize

        public final SoSFFloat pointSize
        Radius of points (for POINTS style). Default is 0, meaning to use the default OpenGL value (1). Point sizes greater than zero are considered to be specified in printer's point, where 1 inch = 72 printer's points. However the default pixels-per-inch value (managed by SbViewportRegion) is also 72. So effectively point size is specified in pixels unless the application sets a different pixels-per-inch value.

        Please see the notes in the class description for more information.

      • lineWidth

        public final SoSFFloat lineWidth
        Width of lines (for LINES style). The default line width is 0, meaning to use the default OpenGL value (1). Line widths greater than zero are considered to be specified in printer's points, where 1 inch = 72 printer's points. However the default pixels-per-inch value (managed by SbViewportRegion) is also 72. So effectively line width is specified in pixels unless the application sets a different pixels-per-inch value.

        Please see the notes in the class description for more information.

      • linePattern

        public final SoSFUShort linePattern
        Stipple pattern for lines (for LINES style). This specifies how dashed or dotted lines will be drawn. The pattern is a 16-bit series of 0s and 1s and is repeated as necessary to stipple a given line. A 1 indicates that drawing occurs, and a 0 that it does not, on a pixel-by-pixel basis, starting with the low-order bits of the pattern. Values can range from 0 (invisible) to 0xffff (solid). Default is 0xffff.

        The line pattern can be stretched using the linePatternScaleFactor field.

      • linePatternScaleFactor

        public final SoSFInt32 linePatternScaleFactor
        Stipple pattern scale factor (for LINES style). It stretches the line pattern (see linePattern) by multiplying each subseries of consecutive 1s and 0s. Scale factors are clamped to lie between 1 and 255. Default is 1.

        Since:
        Open Inventor 4.0

    • Constructor Detail

      • SoDrawStyle

        public SoDrawStyle()
        Creates a drawing style node with default settings.