public class SoViewport extends SoNode
The view volume specified by the current camera will be mapped into this region of the render target (e.g. the viewer window). By default Open Inventor manages the viewport to be the entire render target, even if the window (for example) is resized. So this node is useful for rendering objects in a specific part of the window, for example screen locked annotation graphics like legends and a "compass".
Remember that the camera node's viewportMapping field is set to ADJUST_CAMERA by default. In this mode the camera automatically adjusts its view volume to have the same aspect ratio as the viewport (widening for example) to avoid distorting shapes in the scene. But note that the camera will compare the aspect ratio of its view volume to the aspect ratio of the viewport that is in effect when the camera node is traversed. So it's generally better to create a camera for each viewport and make sure the camera node is traversed after the viewport node. If using multiple viewports with the same camera, generally the viewports should all have the aspect ratio.
Tip: You can use the SoDepthBuffer
node to clear the depth buffer in the viewport region to ensure annotation graphics render correctly. However, in general, you should put an SoViewportClipping
node before this node to limit the effect of the depth buffer clear to the desired viewport.
If you want to place multiple "views" inside the same window, consider the PoView
and PoSceneView
nodes. Views allow the application to specify multiple cameras, each with its own separate viewport Views can be used, for example, to subdivide the window into multiple independent views of a 3D scene or to create an inset "bird's eye" view inside the window, without the overhead of creating separate windows. The advantage of using the view nodes over SoViewport
is that when mouse event locations are mapped back into 3D space, Open Inventor automatically uses the view volume of the camera associated with the view node whose viewport currently contains the mouse cursor.
Viewport {
origin | (0,0) |
size | (0,0) |
Action behavior:
SoGLRenderAction
Sets: SoViewportRegionElement
See also:
SbViewportRegion
, SoViewportClipping
, SoDepthBuffer
, PoView
, PoSceneView
SoNode.RenderModes
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFVec2f |
origin
Specifies the position of the viewport in pixels.
|
SoSFVec2f |
size
Specifies the size of the viewport in pixels.
|
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoViewport()
Constructor.
|
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
getNativeResourceHandle
public final SoSFVec2f origin
public final SoSFVec2f size
Generated on July 31, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com