Base class to draw a scene graph in screen space. More...
#include <Inventor/drawers/SoScreenDrawer.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoScreenDrawer () | |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Public Attributes | |
SoSFNode | sceneGraph |
This node displays the scene graph specified by the sceneGraph field in screen space normalized in the range ([-1, 1]x[-1, 1]x[-1, 1]) relative to the current viewport.
The specified scene graph is automatically rendered using an SoAnnotation node, an SoPickStyle node with style = UNPICKABLE, and an SoOrthographicCamera node.
Classes derived from SoScreenDrawer are normally used to implement dynamically drawing a 2D shape, for example a rectangle, in response to mouse events. Applications will typically use one of these derived classes, for example, SoEllipseScreenDrawer, SoRectangleScreenDrawer, SoPolygonScreenDrawer or SoLassoScreenDrawer.
Please see SoPolyLineScreenDrawer for important notes about these classes and a code example.
Applications may also implement their own custom screen drawer classes. The convenient onMouseDown(), onMouseMove(), ... methods can be implemented by sub-classes to customize behaviors for specific events, but the application can also reimplement the handleEvent() method to handle any event.
There should only be one SoScreenDrawer derived node in the sceneGraph (to avoid conflicts in mouse events).
NOTE: This node and its subclasses use screen coordinates ranging from -1 to 1. (Because this is the default view volume for an SoOrthographicCamera node.) Be careful because other classes in Open Inventor use normalized screen coordinates ranging from 0 to 1. In particular the SbViewportRegion normalize() method and the SbViewVolume methods that project from 3D to 2D and vice-versa.
[C++]
Screen drawer classes must be initialized by calling SoInteraction::init(). High level viewer init methods, like SoWin::init(), automatically do this. However, if the application is calling SoDB::init() directly, then it is usually necessary to also call SoInteraction::init() before using the screen drawer classes.
SoEllipseScreenDrawer SoLassoScreenDrawer SoPolygonScreenDrawer SoPolyLineScreenDrawer SoRectangleScreenDrawer
SoScreenDrawer::SoScreenDrawer | ( | ) |
Constructor.
static SoType SoScreenDrawer::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoNode.
Reimplemented in SoEllipseScreenDrawer, SoLassoScreenDrawer, SoPolygonScreenDrawer, SoPolyLineScreenDrawer, and SoRectangleScreenDrawer.
virtual SoType SoScreenDrawer::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoNode.
Reimplemented in SoEllipseScreenDrawer, SoLassoScreenDrawer, SoPolygonScreenDrawer, SoPolyLineScreenDrawer, and SoRectangleScreenDrawer.
Scene graph to render.