: Class Canvas3D

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.media.j3d
Class Canvas3D

    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Canvas
                  |
                  +--javax.media.j3d.Canvas3D

public class Canvas3D
extends java.awt.Canvas

The Canvas3D class provides a drawing canvas for 3D rendering. It is an extension of the AWT Canvas class that users may further subclass to implement additional functionality. Java 3D will render to all canvases that are attached to an active View object.

See Also:
  `Screen3D`, `View`, Serialized Form

Field Summary
`static int` | `FIELD_ALL` Specifies a single-field rendering loop.
`static int` | `FIELD_LEFT` Specifies the left field of a field-sequential stereo rendering loop.
`static int` | `FIELD_RIGHT` Specifies the right field of a field-sequential stereo rendering loop.

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Constructor Summary
`Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)` Constructs and initializes a new Canvas3D object that Java 3D can render into.

Method Summary
`void` | `addNotify()` Canvas3D uses the addNotify callback to track when it is added to a container.
`void` | `getCenterEyeInImagePlate(Point3d position)` Retrieves the actual position of the center eye in image-plate coordinates and copies that value into the object provided.
`boolean` | `getDoubleBufferAvailable()` Returns a status flag indicating whether or not double buffering is available.
`boolean` | `getDoubleBufferEnable()` Returns a status flag indicating whether or not double buffering is enabled.
`GraphicsContext3D` | `getGraphicsContext3D()` Get the immediate mode 3D graphics context associated with this Canvas3D.
`void` | `getImagePlateToVworld(Transform3D t)` Retrieves the current ImagePlate coordinates to Virtual World coordinates transform and places it into the specified object.
`void` | `getLeftEyeInImagePlate(Point3d position)` Retrieves the actual position of the left eye in image-plate coordinates and copies that value into the object provided.
`void` | `getLeftManualEyeInImagePlate(Point3d position)` Retrieves the position of the user-specified, manual left eye in image-plate coordinates and copies that value into the object provided.
`double` | `getPhysicalHeight()` Retrieves the physical height of this canvas window in meters.
`double` | `getPhysicalWidth()` Retrieves the physical width of this canvas window in meters.
`void` | `getPixelLocationInImagePlate(int x, int y, Point3d position)` Computes the position of the specified AWT pixel value in image-plate coordinates and copies that value into the object provided.
`void` | `getRightEyeInImagePlate(Point3d position)` Retrieves the actual position of the right eye in image-plate coordinates and copies that value into the object provided.
`void` | `getRightManualEyeInImagePlate(Point3d position)` Retrieves the position of the user-specified, manual right eye in image-plate coordinates and copies that value into the object provided.
`boolean` | `getSceneAntialiasingAvailable()` Returns a status flag indicating whether or not scene antialiasing is available.
`Screen3D` | `getScreen3D()` Retrieve the Screen3D object that this Canvas3D is attached to.
`boolean` | `getStereoAvailable()` Returns a status flag indicating whether or not stereo is available.
`boolean` | `getStereoEnable()` Returns a status flag indicating whether or not stereo is enabled.
`View` | `getView()` Gets view that points to this Canvas3D.
`void` | `getVworldToImagePlate(Transform3D t)` Retrieves the current Virtual World coordinates to ImagePlate coordinates transform and places it into the specified object.
`void` | `paint(java.awt.Graphics g)` Canvas3D uses the paint callback to track when it is possible to render into the canvas.
`void` | `postRender()` This routine is called by the Java 3D rendering loop after completing all rendering to the canvas for this frame and before the buffer swap.
`void` | `postSwap()` This routine is called by the Java 3D rendering loop after completing all rendering to the canvas, and all other canvases associated with this view, for this frame following the buffer swap.
`void` | `preRender()` This routine is called by the Java 3D rendering loop after clearing the canvas and before any rendering has been done for this frame.
`void` | `removeNotify()` Canvas3D uses the removeNotify callback to track when it is removed from a container.
`void` | `renderField(int fieldDesc)` This routine is called by the Java 3D rendering loop during the execution of the rendering loop.
`void` | `setDoubleBufferEnable(boolean flag)` Turns double buffering on or off.
`void` | `setLeftEyeInImagePlate(Point3d position)` Deprecated. Use setLeftManualEyeInImagePlate instead.
`void` | `setLeftManualEyeInImagePlate(Point3d position)` Sets the position of the manual left eye in image-plate coordinates.
`void` | `setRightEyeInImagePlate(Point3d position)` Deprecated. Use setRightManualEyeInImagePlate instead.
`void` | `setRightManualEyeInImagePlate(Point3d position)` Sets the position of the manual right eye in image-plate coordinates.
`void` | `setStereoEnable(boolean flag)` Turns stereo on or off.
`void` | `startRenderer()` Start the Java 3D renderer on this Canvas3D object.
`void` | `stopRenderer()` Stop the Java 3D renderer on this Canvas3D object.
`void` | `swap()` Synchronize and swap buffers on a double buffered canvas for this Canvas3D object.

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### FIELD_LEFT

    public static final int FIELD_LEFT

  Specifies the left field of a field-sequential stereo rendering loop. A left field always precedes a right field.

### FIELD_RIGHT

    public static final int FIELD_RIGHT

  Specifies the right field of a field-sequential stereo rendering loop. A right field always follows a left field.

### FIELD_ALL

    public static final int FIELD_ALL

  Specifies a single-field rendering loop.

Constructor Detail

### Canvas3D

    public Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)

  Constructs and initializes a new Canvas3D object that Java 3D can render into. The following Canvas3D attributes are initialized to default values as shown:
  left manual eye in image plate : (0.142, 0.135, 0.4572)
  right manual eye in image plate : (0.208, 0.135, 0.4572)
  stereo enable : true
  double buffer enable : true
  Parameters:
    `graphicsConfiguration` - a valid GraphicsConfiguration object that will be used to create the canvas.
  See Also:
    `GraphicsConfiguration`

Method Detail

### paint

    public void paint(java.awt.Graphics g)

  Canvas3D uses the paint callback to track when it is possible to render into the canvas. Subclasses of Canvas3D that override this method need to call super.paint() in thier paint method for Java 3D to function properly.
  Overrides:
    paint in class java.awt.Canvas

### addNotify

    public void addNotify()

  Canvas3D uses the addNotify callback to track when it is added to a container. Subclasses of Canvas3D that override this method need to call super.addNotify() in thier addNotify() method for Java 3D to function properly.
  Overrides:
    addNotify in class java.awt.Canvas

### removeNotify

    public void removeNotify()

  Canvas3D uses the removeNotify callback to track when it is removed from a container. Subclasses of Canvas3D that override this method need to call super.removeNotify() in their removeNotify() method for Java 3D to function properly.
  Overrides:
    removeNotify in class java.awt.Component

### getScreen3D

    public final Screen3D getScreen3D()

  Retrieve the Screen3D object that this Canvas3D is attached to.
  Returns:
    the 3D screen object that this Canvas3D is attached to

### getGraphicsContext3D

    public final GraphicsContext3D getGraphicsContext3D()

  Get the immediate mode 3D graphics context associated with this Canvas3D. A new graphics context object is created if one does not already exist.
  Returns:
    a GraphicsContext3D object that can be used for immediate mode rendering to this Canvas3D.

### preRender

    public void preRender()

  This routine is called by the Java 3D rendering loop after clearing the canvas and before any rendering has been done for this frame. Applications that wish to perform operations in the rendering loop, prior to any actual rendering may override this function.
  NOTE: Applications should not call this method.

### postRender

    public void postRender()

  This routine is called by the Java 3D rendering loop after completing all rendering to the canvas for this frame and before the buffer swap. Applications that wish to perform operations in the rendering loop, following any actual rendering may override this function.
  NOTE: Applications should not call this method.

### postSwap

    public void postSwap()

  This routine is called by the Java 3D rendering loop after completing all rendering to the canvas, and all other canvases associated with this view, for this frame following the buffer swap. Applications that wish to perform operations at the very end of the rendering loop may override this function.
  NOTE: Applications should not call this method.

### renderField

    public void renderField(int fieldDesc)

  This routine is called by the Java 3D rendering loop during the execution of the rendering loop. It is called once for each field (i.e., once per frame on a mono system or once each for the right eye and left eye on a two-pass stereo system. This is intended for use by applications that want to mix retained/compiled-retained mode rendering with some immediate mode rendering. Applications that wish to perform operations during the rendering loop, may override this function.
  NOTE: Applications should not call this method.
  Parameters:
    `fieldDesc` - field description, one of: FIELD_LEFT, FIELD_RIGHT or FIELD_ALL. Applications that wish to work correctly in stereo mode should render the same image for both FIELD_LEFT and FIELD_RIGHT calls. If Java 3D calls the renderer with FIELD_ALL then the immediate mode rendering only needs to be done once.

### stopRenderer

    public final void stopRenderer()

  Stop the Java 3D renderer on this Canvas3D object. If the Java 3D renderer is currently running, the rendering will be synchronized before being stopped. No further rendering will be done to this canvas by Java 3D until the renderer is started again. In pure immediate mode this method should be called prior to adding this canvas to an active View object.

### startRenderer

    public final void startRenderer()

  Start the Java 3D renderer on this Canvas3D object. If the Java 3D renderer is not currently running, any rendering to other Canvas3D objects sharing the same View will be synchronized before this Canvas3D's renderer is (re)started. When a Canvas3D is created, it is initially marked as being started. This means that as soon as the Canvas3D is added to an active View object, the rendering loop will render the scene graph to the canvas.

### swap

    public final void swap()

  Synchronize and swap buffers on a double buffered canvas for this Canvas3D object. This method should only be called if the Java 3D renderer has been stopped. In the normal case, the renderer automatically swaps the buffer. If the Java 3D renderer is running for this canvas then a RestrictedAccessException exception is thrown.
  Throws:
    RestrictedAccessException - if the Java 3D renderer is running.
  See Also:
    `stopRenderer()`

### setLeftEyeInImagePlate

    public final void setLeftEyeInImagePlate(Point3d position)

  Deprecated. Use setLeftManualEyeInImagePlate instead.

### setRightEyeInImagePlate

    public final void setRightEyeInImagePlate(Point3d position)

  Deprecated. Use setRightManualEyeInImagePlate instead.

### setLeftManualEyeInImagePlate

    public final void setLeftManualEyeInImagePlate(Point3d position)

  Sets the position of the manual left eye in image-plate coordinates. This value determines eye placement when a head tracker is not in use and the application is directly controlling the eye position in image-plate coordinates. In head-tracked mode or when the windowEyePointPolicy is RELATIVE_TO_FIELD_OF_VIEW, this value is ignored. When the windowEyepointPolicy is RELATIVE_TO_WINDOW only the Z value is used.
  Parameters:
    `position` - the new manual left eye position

### setRightManualEyeInImagePlate

    public final void setRightManualEyeInImagePlate(Point3d position)

  Sets the position of the manual right eye in image-plate coordinates. This value determines eye placement when a head tracker is not in use and the application is directly controlling the eye position in image-plate coordinates. In head-tracked mode or when the windowEyePointPolicy is RELATIVE_TO_FIELD_OF_VIEW, this value is ignored. When the windowEyepointPolicy is RELATIVE_TO_WINDOW only the Z value is used.
  Parameters:
    `position` - the new manual right eye position

### getLeftManualEyeInImagePlate

    public final void getLeftManualEyeInImagePlate(Point3d position)

  Retrieves the position of the user-specified, manual left eye in image-plate coordinates and copies that value into the object provided.
  Parameters:
    `position` - the object that will receive the position

### getRightManualEyeInImagePlate

    public final void getRightManualEyeInImagePlate(Point3d position)

  Retrieves the position of the user-specified, manual right eye in image-plate coordinates and copies that value into the object provided.
  Parameters:
    `position` - the object that will receive the position

### getLeftEyeInImagePlate

    public final void getLeftEyeInImagePlate(Point3d position)

  Retrieves the actual position of the left eye in image-plate coordinates and copies that value into the object provided. This value is a function of the windowEyepointPolicy, the tracking enable flag, and the manual left eye position.
  Parameters:
    `position` - the object that will receive the position

### getRightEyeInImagePlate

    public final void getRightEyeInImagePlate(Point3d position)

  Retrieves the actual position of the right eye in image-plate coordinates and copies that value into the object provided. This value is a function of the windowEyepointPolicy, the tracking enable flag, and the manual right eye position.
  Parameters:
    `position` - the object that will receive the position

### getCenterEyeInImagePlate

    public final void getCenterEyeInImagePlate(Point3d position)

  Retrieves the actual position of the center eye in image-plate coordinates and copies that value into the object provided. The center eye is the fictional eye half-way between the left and right eye. This value is a function of the windowEyepointPolicy, the tracking enable flag, and the manual right and left eye positions.
  Parameters:
    `position` - the object that will receive the position
  See Also:
    `View.setMonoscopicViewPolicy(int)`

### getImagePlateToVworld

    public final void getImagePlateToVworld(Transform3D t)

  Retrieves the current ImagePlate coordinates to Virtual World coordinates transform and places it into the specified object.
  Parameters:
    `t` - the Transform3D object that will receive the transform

### getPixelLocationInImagePlate

    public final void getPixelLocationInImagePlate(int x,
                                                   int y,
                                                   Point3d position)

  Computes the position of the specified AWT pixel value in image-plate coordinates and copies that value into the object provided.
  Parameters:
    `x` - the X coordinate of the pixel relative to the upper-left hand corner of the window.
    `y` - the Y coordinate of the pixel relative to the upper-left hand corner of the window.
    `position` - the object that will receive the position in physical image plate coordinates (relative to the lower-left corner of the screen).

### getPhysicalWidth

    public final double getPhysicalWidth()

  Retrieves the physical width of this canvas window in meters.
  Returns:
    the physical window width in meters.

### getPhysicalHeight

    public final double getPhysicalHeight()

  Retrieves the physical height of this canvas window in meters.
  Returns:
    the physical window height in meters.

### getVworldToImagePlate

    public final void getVworldToImagePlate(Transform3D t)

  Retrieves the current Virtual World coordinates to ImagePlate coordinates transform and places it into the specified object.
  Parameters:
    `t` - the Transform3D object that will receive the transform

### getView

    public final View getView()

  Gets view that points to this Canvas3D.
  Returns:
    view object that points to this Canvas3D

### getStereoAvailable

    public final boolean getStereoAvailable()

  Returns a status flag indicating whether or not stereo is available.
  Returns:
    a flag indicating whether stereo is available

### setStereoEnable

    public final void setStereoEnable(boolean flag)

  Turns stereo on or off. Note that this attribute is used only when stereo is available. Enableing stereo on a Cavas3D that does not support stereo has no effect.
  Parameters:
    `flag` - enables or disables the display of stereo

### getStereoEnable

    public final boolean getStereoEnable()

  Returns a status flag indicating whether or not stereo is enabled.
  Returns:
    a flag indicating whether stereo is enabled

### getDoubleBufferAvailable

    public final boolean getDoubleBufferAvailable()

  Returns a status flag indicating whether or not double buffering is available.
  Returns:
    a flag indicating whether double buffering is available.

### setDoubleBufferEnable

    public final void setDoubleBufferEnable(boolean flag)

  Turns double buffering on or off. If double buffering is off, all drawing is to the front buffer and no buffer swap is done between frames. It should be stressed that running Java 3D with double buffering disabled is not recommended.
  Parameters:
    `flag` - enables or disables double buffering.

### getDoubleBufferEnable

    public final boolean getDoubleBufferEnable()

  Returns a status flag indicating whether or not double buffering is enabled.
  Returns:
    a flag indicating if double buffering is enabled.

### getSceneAntialiasingAvailable

    public final boolean getSceneAntialiasingAvailable()

  Returns a status flag indicating whether or not scene antialiasing is available.
  Returns:
    a flag indicating whether scene antialiasing is available.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD