Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
Overview

Although Inventor provides predefined highlight styles, at times you may want to highlight selected objects with a different style. You can provide your own highlight style in two ways: derive a new highlight class from

SoGLRenderAction (described here), or make changes directly to the scene graph whenever the selection changes (using SoSelection callbacks, as described in Handling Events and Selection). If you're using manipulators, it's probably easiest to allow the manipulator to make changes to the scene graph through use of selection callbacks. In this case, the manipulator shows which objects are selected.

Creating a new highlight style by deriving a class from SoGLRenderAction is basically the same as deriving any new action class, as described in Creating an Action. You can use the action-class macros found in SoSubAction.h. The SO_ACTION_HEADER() macro declares type identifier and naming variables and methods that all node classes must support. The SO_ACTION_SOURCE() macro defines the static variables and methods declared in the SO_ACTION_HEADER() macro.

Creating a new highlight action class requires these steps:

  1. Select a name for the new highlight class. It will be derived from SoGLRenderAction or another highlight class.
  2. Define an initClass() method to initialize the type information. Use the SO_ACTION_INIT_CLASS() macro.
  3. Define an exitClass() method to clean up the type information. In the exitClass() routine of your class, use the macro SO_ACTION_EXIT_CLASS.
  4. Define a constructor. Use the SO_ACTION_CONSTRUCTOR() macro.
  5. Implement the virtual apply() method (see The apply() Method).
  6. Implement other methods, if desired, to specify the appearance of the highlight. These optional methods include

    setColor(), setLinePattern(), and setLineWidth().