|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--javax.media.j3d.Canvas3D
The Canvas3D class provides a drawing canvas for 3D rendering. It is used either for on-screen rendering or off-screen rendering. Canvas3D is an extension of the AWT Canvas class that users may further subclass to implement additional functionality.
The Canvas3D object extends the Canvas object to include 3D-related information such as the size of the canvas in pixels, the Canvas3D's location, also in pixels, within a Screen3D object, and whether or not the canvas has stereo enabled.
Because all Canvas3D objects contain a reference to a Screen3D object and because Screen3D objects define the size of a pixel in physical units, Java 3D can convert a Canvas3D size in pixels to a physical world size in meters. It can also determine the Canvas3D's position and orientation in the physical world.
On-screen Rendering vs. Off-screen Rendering
The Canvas3D class is used either for on-screen rendering or off-screen rendering. On-screen Canvas3Ds are added to AWT or Swing Container objects like any other canvas. Java 3D automatically and continuously renders to all on-screen canvases that are attached to an active View object. On-screen Canvas3Ds can be either single or double buffered and they can be either stereo or monoscopic.
Off-screen Canvas3Ds must not be added to any Container. Java 3D
renders to off-screen canvases in response to the
renderOffScreenBuffer
method. Off-screen Canvas3Ds
are single buffered. However, on many systems, the actual
rendering is done to an off-screen hardware buffer or to a 3D
library-specific buffer and only copied to the off-screen buffer of
the Canvas when the rendering is complete, at "buffer swap" time.
Off-screen Canvas3Ds are monoscopic.
The setOffScreenBuffer method sets the off-screen buffer for this Canvas3D. The specified image is written into by the Java 3D renderer. The size of the specified ImageComponent determines the size, in pixels, of this Canvas3D - the size inherited from Component is ignored. Note that the size, physical width, and physical height of the associated Screen3D must be set explicitly prior to rendering. Failure to do so will result in an exception.
The getOffScreenBuffer method retrieves the off-screen buffer for this Canvas3D.
The renderOffScreenBuffer method schedules the rendering of a frame into this Canvas3D's off-screen buffer. The rendering is done from the point of view of the View object to which this Canvas3D has been added. No rendering is performed if this Canvas3D object has not been added to an active View. This method does not wait for the rendering to actually happen. An application that wishes to know when the rendering is complete must either subclass Canvas3D and override the postSwap method, or call waitForOffScreenRendering.
The setOfScreenLocation methods set the location of this off-screen Canvas3D. The location is the upper-left corner of the Canvas3D relative to the upper-left corner of the corresponding off-screen Screen3D. The function of these methods is similar to that of Component.setLocation for on-screen Canvas3D objects. The default location is (0,0).
Accessing and Modifying an Eye's Image Plate Position
A Canvas3D object provides sophisticated applications with access to the eye's position information in head-tracked, room-mounted runtime environments. It also allows applications to manipulate the position of an eye relative to an image plate in non-head-tracked runtime environments.
The setLeftManualEyeInImagePlate and setRightManualEyeInImagePlate methods set the position of the manual left and right eyes in image plate coordinates. These values determine 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 or RELATIVE_TO_COEXISTENCE, this value is ignored. When the windowEyepointPolicy is RELATIVE_TO_WINDOW, only the Z value is used.
The getLeftEyeInImagePlate, getRightEyeInImagePlate, and getCenterEyeInImagePlate methods retrieve the actual position of the left eye, right eye, and center eye in image plate coordinates and copy that value into the object provided. The center eye is the fictional eye half-way between the left and right eye. These three values are a function of the windowEyepointPolicy, the tracking enable flag, and the manual left, right, and center eye positions.
Monoscopic View Policy
The setMonoscopicViewPolicy and getMonoscopicViewPolicy methods set and retrieve the policy regarding how Java 3D generates monoscopic view. If the policy is set to View.LEFT_EYE_VIEW, the view generated corresponds to the view as seen from the left eye. If set to View.RIGHT_EYE_VIEW, the view generated corresponds to the view as seen from the right eye. If set to View.CYCLOPEAN_EYE_VIEW, the view generated corresponds to the view as seen from the "center eye," the fictional eye half-way between the left and right eye. The default monoscopic view policy is View.CYCLOPEAN_EYE_VIEW.
Immediate Mode Rendering
Pure immediate-mode rendering provides for those applications and applets that do not want Java 3D to do any automatic rendering of the scene graph. Such applications may not even wish to build a scene graph to represent their graphical data. However, they use Java 3D's attribute objects to set graphics state and Java 3D's geometric objects to render geometry.
A pure immediate mode application must create a minimal set of Java 3D objects before rendering. In addition to a Canvas3D object, the application must create a View object, with its associated PhysicalBody and PhysicalEnvironment objects, and the following scene graph elements: a VirtualUniverse object, a high-resolution Locale object, a BranchGroup node object, a TransformGroup node object with associated transform, and a ViewPlatform leaf node object that defines the position and orientation within the virtual universe that generates the view.
In immediate mode, all rendering is done completely under user
control. It is necessary for the user to clear the 3D canvas,
render all geometry, and swap the buffers. Additionally,
rendering the right and left eye for stereo viewing becomes the
sole responsibility of the application. In pure immediate mode,
the user must stop the Java 3D renderer, via the
Canvas3D object stopRenderer
method, prior to adding the
Canvas3D object to an active View object (that is, one that is
attached to a live ViewPlatform object).
Other Canvas3D methods related to immediate mode rendering are:
getGraphicsContext3D
retrieves the immediate-mode
3D graphics context associated with this Canvas3D. It creates a
new graphics context if one does not already exist.
getGraphics2D
retrieves the
2D graphics object associated with this Canvas3D. It creates a
new 2D graphics object if one does not already exist.
swap
synchronizes and swaps 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.
Mixed Mode Rendering
Mixing immediate mode and retained or compiled-retained mode requires more structure than pure immediate mode. In mixed mode, the Java 3D renderer is running continuously, rendering the scene graph into the canvas.
Canvas3D methods related to mixed mode rendering are:
preRender
called by the Java 3D rendering loop after
clearing the canvas and before any rendering has been done for
this frame.
postRender
called by the Java 3D rendering loop after
completing all rendering to the canvas for this frame and before
the buffer swap.
postSwap
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.
renderField
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.
The above callback methods are called by the Java 3D rendering system and should not be called by an application directly.
The basic Java 3D stereo rendering loop, executed for each Canvas3D, is as follows:
clear canvas (both eyes) call preRender() // user-supplied method set left eye view render opaque scene graph objects call renderField(FIELD_LEFT) // user-supplied method render transparent scene graph objects set right eye view render opaque scene graph objects again call renderField(FIELD_RIGHT) // user-supplied method render transparent scene graph objects again call postRender() // user-supplied method synchronize and swap buffers call postSwap() // user-supplied method
The basic Java 3D monoscopic rendering loop is as follows:
clear canvas call preRender() // user-supplied method set view render opaque scene graph objects call renderField(FIELD_ALL) // user-supplied method render transparent scene graph objects call postRender() // user-supplied method synchronize and swap buffers call postSwap() // user-supplied method
In both cases, the entire loop, beginning with clearing the canvas and ending with swapping the buffers, defines a frame. The application is given the opportunity to render immediate-mode geometry at any of the clearly identified spots in the rendering loop. A user specifies his or her own rendering methods by extending the Canvas3D class and overriding the preRender, postRender, postSwap, and/or renderField methods. Updates to live Geometry, Texture, and ImageComponent objects in the scene graph are not allowed from any of these callback methods.
Serialization
Canvas3D does not support serialization. An attempt to serialize a Canvas3D object will result in an UnsupportedOperationException being thrown.
Screen3D
,
View
,
GraphicsContext3D
,
Serialized FormNested Class Summary |
Nested classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
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 |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)
Constructs and initializes a new Canvas3D object that Java 3D can render into. |
|
Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration,
boolean offScreen)
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. |
java.awt.Rectangle |
getBounds()
|
java.awt.Rectangle |
getBounds(java.awt.Rectangle rv)
|
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. |
J3DGraphics2D |
getGraphics2D()
Get the 2D graphics object associated with this Canvas3D. |
GraphicsContext3D |
getGraphicsContext3D()
Get the immediate mode 3D graphics context associated with this Canvas3D. |
int |
getHeight()
|
void |
getImagePlateToVworld(Transform3D t)
Retrieves the current ImagePlate coordinates to Virtual World coordinates transform and places it into the specified object. |
void |
getInverseVworldProjection(Transform3D leftInverseProjection,
Transform3D rightInverseProjection)
Copies the inverse of the current Vworld projection transform for each eye into the specified Transform3D objects. |
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. |
java.awt.Point |
getLocation()
|
java.awt.Point |
getLocation(java.awt.Point rv)
|
java.awt.Point |
getLocationOnScreen()
|
int |
getMonoscopicViewPolicy()
Returns policy on how Java 3D generates monoscopic view. |
ImageComponent2D |
getOffScreenBuffer()
Retrieves the off-screen buffer for this Canvas3D. |
java.awt.Point |
getOffScreenLocation()
Retrieves the location of this off-screen Canvas3D. |
java.awt.Point |
getOffScreenLocation(java.awt.Point rv)
Retrieves the location of this off-screen Canvas3D and stores it in the specified Point object. |
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 |
getPixelLocationFromImagePlate(Point3d imagePlatePoint,
Point2d pixelLocation)
Projects the specified point from image plate coordinates into AWT pixel coordinates. |
void |
getPixelLocationInImagePlate(int x,
int y,
Point3d imagePlatePoint)
Computes the position of the specified AWT pixel value in image-plate coordinates and copies that value into the object provided. |
void |
getPixelLocationInImagePlate(Point2d pixelLocation,
Point3d imagePlatePoint)
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. |
java.awt.Dimension |
getSize()
|
java.awt.Dimension |
getSize(java.awt.Dimension rv)
|
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 |
getVworldProjection(Transform3D leftProjection,
Transform3D rightProjection)
Copies the current Vworld projection transform for each eye into the specified Transform3D objects. |
void |
getVworldToImagePlate(Transform3D t)
Retrieves the current Virtual World coordinates to ImagePlate coordinates transform and places it into the specified object. |
int |
getWidth()
|
int |
getX()
|
int |
getY()
|
boolean |
isOffScreen()
Retrieves a flag indicating whether this Canvas3D is an off-screen canvas. |
boolean |
isRendererRunning()
Retrieves the state of the renderer for this Canvas3D 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. |
java.util.Map |
queryProperties()
Returns a read-only Map object containing key-value pairs that define various properties for this Canvas3D. |
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 |
renderOffScreenBuffer()
Schedules the rendering of a frame into this Canvas3D's off-screen buffer. |
void |
setDoubleBufferEnable(boolean flag)
Turns double buffering on or off. |
void |
setLeftManualEyeInImagePlate(Point3d position)
Sets the position of the manual left eye in image-plate coordinates. |
void |
setMonoscopicViewPolicy(int policy)
Specifies how Java 3D generates monoscopic view. |
void |
setOffScreenBuffer(ImageComponent2D buffer)
Sets the off-screen buffer for this Canvas3D. |
void |
setOffScreenLocation(int x,
int y)
Sets the location of this off-screen Canvas3D. |
void |
setOffScreenLocation(java.awt.Point p)
Sets the location of this off-screen Canvas3D. |
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. |
void |
waitForOffScreenRendering()
Waits for this Canvas3D's off-screen rendering to be done. |
Methods inherited from class java.awt.Canvas |
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FIELD_LEFT
public static final int FIELD_RIGHT
public static final int FIELD_ALL
Constructor Detail |
public Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)
graphicsConfiguration
- a valid GraphicsConfiguration object that
will be used to create the canvas. This object should not be null and
should be created using a GraphicsConfigTemplate3D or the
getPreferredConfiguration() method of the SimpleUniverse utility. For
backward compatibility with earlier versions of Java 3D, a null or
default GraphicsConfiguration will still work when used to create a
Canvas3D on the default screen, but an error message will be printed.
A NullPointerException or IllegalArgumentException will be thrown in a
subsequent release.
java.lang.IllegalArgumentException
- if the specified
GraphicsConfiguration does not support 3D renderingpublic Canvas3D(java.awt.GraphicsConfiguration graphicsConfiguration, boolean offScreen)
graphicsConfiguration
- a valid GraphicsConfiguration object
that will be used to create the canvas. This must be created either
with a GraphicsConfigTemplate3D or by using the
getPreferredConfiguration() method of the SimpleUniverse utility.offScreen
- a flag that indicates whether this canvas is
an off-screen 3D rendering canvas. Note that if offScreen
is set to true, this Canvas3D object cannot be used for normal
rendering; it should not be added to any Container object.
java.lang.NullPointerException
- if the GraphicsConfiguration
is null.
java.lang.IllegalArgumentException
- if the specified
GraphicsConfiguration does not support 3D renderingMethod Detail |
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
g
- the graphics contextpublic void addNotify()
addNotify
in class java.awt.Canvas
public void removeNotify()
removeNotify
in class java.awt.Component
public Screen3D getScreen3D()
public GraphicsContext3D getGraphicsContext3D()
public J3DGraphics2D getGraphics2D()
public void preRender()
Updates to live Geometry, Texture, and ImageComponent objects in the scene graph are not allowed from this method.
NOTE: Applications should not call this method.
public void postRender()
Updates to live Geometry, Texture, and ImageComponent objects in the scene graph are not allowed from this method.
NOTE: Applications should not call this method.
public void postSwap()
Updates to live Geometry, Texture, and ImageComponent objects in the scene graph are not allowed from this method.
NOTE: Applications should not call this method.
public void renderField(int fieldDesc)
Updates to live Geometry, Texture, and ImageComponent objects in the scene graph are not allowed from this method.
NOTE: Applications should not call this method.
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.public final void stopRenderer()
java.lang.IllegalStateException
- if this Canvas3D is in
off-screen mode.public final void startRenderer()
public final boolean isRendererRunning()
public boolean isOffScreen()
true
if this Canvas3D is an off-screen canvas;
false
if this is an on-screen canvas.public void setOffScreenBuffer(ImageComponent2D buffer)
NOTE: the size, physical width, and physical height of the associated Screen3D must be set explicitly prior to rendering. Failure to do so will result in an exception.
buffer
- the image component that will be rendered into by
subsequent calls to renderOffScreenBuffer.
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode.
RestrictedAccessException
- if an off-screen rendering
is in process for this Canvas3D.
IllegalSharingException
- if the specified
ImageComponent2D is used by more than one Canvas3D.
java.lang.IllegalArgumentException
- if the specified
ImageComponent2D is in by-reference mode and its
RenderedImage is not an instance of a BufferedImage or
if the ImageComponent2D format is FORMAT_CHANNEL8.renderOffScreenBuffer()
,
Screen3D.setSize(int, int)
,
Screen3D.setSize(Dimension)
,
Screen3D.setPhysicalScreenWidth(double)
,
Screen3D.setPhysicalScreenHeight(double)
public ImageComponent2D getOffScreenBuffer()
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode.public void renderOffScreenBuffer()
postSwap
method, or call
waitForOffScreenRendering
.
java.lang.NullPointerException
- if the off-screen buffer is null.
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode, or if either the width or the height of
the associated Screen3D's size is <= 0, or if the associated
Screen3D's physical width or height is <= 0.
RestrictedAccessException
- if an off-screen rendering
is already in process for this Canvas3D or if the Java 3D renderer
is stopped.setOffScreenBuffer(javax.media.j3d.ImageComponent2D)
,
Screen3D.setSize(int, int)
,
Screen3D.setSize(Dimension)
,
Screen3D.setPhysicalScreenWidth(double)
,
Screen3D.setPhysicalScreenHeight(double)
,
waitForOffScreenRendering()
,
postSwap()
public void waitForOffScreenRendering()
postSwap
method of this
off-screen Canvas3D has completed. If this Canvas3D has not
been added to an active view or if the renderer is stopped for this
Canvas3D, then this method will return
immediately. This method must not be called from a render
callback method of an off-screen Canvas3D.
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode, or if this method is called from a render
callback method of an off-screen Canvas3D.renderOffScreenBuffer()
,
postSwap()
public void setOffScreenLocation(int x, int y)
Component.setLocation
for on-screen Canvas3D
objects. The default location is (0,0).
x
- the x coordinate of the upper-left corner of
the new location.y
- the y coordinate of the upper-left corner of
the new location.
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode.public void setOffScreenLocation(java.awt.Point p)
Component.setLocation
for on-screen Canvas3D
objects. The default location is (0,0).
p
- the point defining the upper-left corner of the new
location.
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode.public java.awt.Point getOffScreenLocation()
Component.getLocation
for on-screen Canvas3D
objects.
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode.public java.awt.Point getOffScreenLocation(java.awt.Point rv)
Component.getLocation
for on-screen Canvas3D
objects. This version of getOffScreenLocation
is
useful if the caller wants to avoid allocating a new Point
object on the heap.
rv
- Point object into which the upper-left corner of the
location of this off-screen Canvas3D is copied.
If rv
is null, a new Point is allocated.
rv
java.lang.IllegalStateException
- if this Canvas3D is not in
off-screen mode.public void swap()
flush(true)
methods of the
associated 2D and 3D graphics contexts, if they have been allocated.
RestrictedAccessException
- if the Java 3D renderer is
running.
java.lang.IllegalStateException
- if this Canvas3D is in
off-screen mode.stopRenderer()
,
GraphicsContext3D.flush(boolean)
,
J3DGraphics2D.flush(boolean)
public void setLeftManualEyeInImagePlate(Point3d position)
position
- the new manual left eye positionpublic void setRightManualEyeInImagePlate(Point3d position)
position
- the new manual right eye positionpublic void getLeftManualEyeInImagePlate(Point3d position)
position
- the object that will receive the positionpublic void getRightManualEyeInImagePlate(Point3d position)
position
- the object that will receive the positionpublic void getLeftEyeInImagePlate(Point3d position)
position
- the object that will receive the positionpublic void getRightEyeInImagePlate(Point3d position)
position
- the object that will receive the positionpublic void getCenterEyeInImagePlate(Point3d position)
position
- the object that will receive the positionsetMonoscopicViewPolicy(int)
public void getImagePlateToVworld(Transform3D t)
t
- the Transform3D object that will receive the
transformpublic void getPixelLocationInImagePlate(int x, int y, Point3d imagePlatePoint)
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.imagePlatePoint
- the object that will receive the position in
physical image plate coordinates (relative to the lower-left
corner of the screen).public void getPixelLocationInImagePlate(Point2d pixelLocation, Point3d imagePlatePoint)
pixelLocation
- the coordinates of the pixel relative to
the upper-left hand corner of the window.imagePlatePoint
- the object that will receive the position in
physical image plate coordinates (relative to the lower-left
corner of the screen).public void getPixelLocationFromImagePlate(Point3d imagePlatePoint, Point2d pixelLocation)
imagePlatePoint
- the position in
physical image plate coordinates (relative to the lower-left
corner of the screen).pixelLocation
- the object that will receive the coordinates
of the pixel relative to the upper-left hand corner of the window.public void getVworldProjection(Transform3D leftProjection, Transform3D rightProjection)
leftProjection
- the Transform3D object that will receive
a copy of the current projection transform for the left eye.rightProjection
- the Transform3D object that will receive
a copy of the current projection transform for the right eye.public void getInverseVworldProjection(Transform3D leftInverseProjection, Transform3D rightInverseProjection)
leftInverseProjection
- the Transform3D object that will
receive a copy of the current inverse projection transform for
the left eye.rightInverseProjection
- the Transform3D object that will
receive a copy of the current inverse projection transform for
the right eye.public double getPhysicalWidth()
public double getPhysicalHeight()
public void getVworldToImagePlate(Transform3D t)
t
- the Transform3D object that will receive the
transformpublic View getView()
public boolean getStereoAvailable()
((Boolean)queryProperties().
get("stereoAvailable")).
booleanValue()
public void setStereoEnable(boolean flag)
flag
- enables or disables the display of stereoqueryProperties()
public boolean getStereoEnable()
public void setMonoscopicViewPolicy(int policy)
NOTE: for backward compatibility with Java 3D 1.1, if this attribute is set to its default value of View.CYCLOPEAN_EYE_VIEW, the monoscopic view policy in the View object will be used. An application should not use both the deprecated View method and this Canvas3D method at the same time.
policy
- one of View.LEFT_EYE_VIEW, View.RIGHT_EYE_VIEW, or
View.CYCLOPEAN_EYE_VIEW.
java.lang.IllegalStateException
- if the specified
policy is CYCLOPEAN_EYE_VIEW, the canvas is a stereo canvas,
and the viewPolicy for the associated view is HMD_VIEWpublic int getMonoscopicViewPolicy()
public boolean getDoubleBufferAvailable()
((Boolean)queryProperties().
get("doubleBufferAvailable")).
booleanValue()
public void setDoubleBufferEnable(boolean flag)
flag
- enables or disables double buffering.queryProperties()
public boolean getDoubleBufferEnable()
public boolean getSceneAntialiasingAvailable()
((Boolean)queryProperties().
get("sceneAntialiasingAvailable")).
booleanValue()
public final java.util.Map queryProperties()
The currently defined keys are:
Key (String) | Value Type |
doubleBufferAvailable |
Boolean |
stereoAvailable |
Boolean |
sceneAntialiasingAvailable |
Boolean |
sceneAntialiasingNumPasses |
Integer |
texture3DAvailable |
Boolean |
textureColorTableSize |
Integer |
textureLodRangeAvailable |
Boolean |
textureLodOffsetAvailable |
Boolean |
textureWidthMax |
Integer |
textureHeightMax |
Integer |
textureBoundaryWidthMax |
Integer |
textureEnvCombineAvailable |
Boolean |
textureCombineDot3Available |
Boolean |
textureCombineSubtractAvailable |
Boolean |
textureUnitStateMax |
Integer |
textureCubeMapAvailable |
Boolean |
textureDetailAvailable |
Boolean |
textureSharpenAvailable |
Boolean |
textureFilter4Available |
Boolean |
textureAnisotropicFilterDegreeMax |
Float |
compressedGeometry.majorVersionNumber |
Integer |
compressedGeometry.minorVersionNumber |
Integer |
compressedGeometry.minorMinorVersionNumber |
Integer |
native.version |
String |
The descriptions of the values returned for each key are as follows:
doubleBufferAvailable
stereoAvailable
sceneAntialiasingAvailable
sceneAntialiasingNumPasses
texture3DAvailable
textureColorTableSize
textureLodRangeAvailable
textureLodOffsetAvailable
textureWidthMax
textureHeightMax
textureBoundaryWidthMax
textureEnvCombineAvailable
textureCombineDot3Available
textureCombineSubtractAvailable
textureUnitStateMax
textureCubeMapAvailable
textureDetailAvailable
textureSharpenAvailable
textureFilter4Available
textureAnisotropicFilterDegreeMax
compressedGeometry.majorVersionNumber
compressedGeometry.minorVersionNumber
compressedGeometry.minorMinorVersionNumber
native.version
public java.awt.Dimension getSize()
getSize
in class java.awt.Component
public java.awt.Dimension getSize(java.awt.Dimension rv)
getSize
in class java.awt.Component
public java.awt.Point getLocationOnScreen()
getLocationOnScreen
in class java.awt.Component
public int getX()
getX
in class java.awt.Component
public int getY()
getY
in class java.awt.Component
public int getWidth()
getWidth
in class java.awt.Component
public int getHeight()
getHeight
in class java.awt.Component
public java.awt.Point getLocation(java.awt.Point rv)
getLocation
in class java.awt.Component
public java.awt.Point getLocation()
getLocation
in class java.awt.Component
public java.awt.Rectangle getBounds()
getBounds
in class java.awt.Component
public java.awt.Rectangle getBounds(java.awt.Rectangle rv)
getBounds
in class java.awt.Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |