Java Reference
In-Depth Information
Figure 14. Setting up Canvas3D objects
public Canvas3D (GraphicsConfiguration graphicsConfiguration)
public Canvas3D (GraphicsConfiguration graphicsConfiguration, boolean offScreen)
// construct a Canvas3D object with the following default parameters:
// 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
// monoscopic view policy = View.CYCLOPEAN_EYE_VIEW
// off-screen mode = false
// off-screen buffer = null
// off-screen location = (0,0)
View view = new View();
GraphicsConfiguration config = viewManager.getPreferredGraphicsConfiguration();
Canvas3D canvas3D1 = new Canvas3D(config);
Canvas3D canvas3D2 = new Canvas3D(config);
simply using the getPreferredgraphicsConfiguration method in ViewManager. Also, an
off-screen Canvas3D object cannot be used for normal rendering and it must not be added
into any Container object for displaying on screen.
There are three monoscopic policies that can be selected for the rendering of a mono-
scopic view. They correspond to producing a view based on the left, right and a fictional
center eye. The use of the center eye is the default. Figure 15 illustrates the important code
segment for selecting these policies and the results that are rendered.
Note that the code segment adds three Canvas3D objects to a View object through
the use of an array for the rendering of three different views, each based on a different
monoscopic view policy.
Through a Canvas3D object, the positions of the eyes can be changed manually at run
time. Figures 16 to 18 give the code segment and results in an interactive example where
the user can alter the eye positions by clicking some relevant buttons and observe the
In the createViewGraph method, lines 5 to 7 are for the purpose of creating buttons,
while line 13 invokes the createPanel method of Figure 17 to create the panels for two views.
Lines 14 and 15 set the left and right Canvas3D objects to show the views of the left and
right eyes, respectively. Then, a ZOOM_OUT view is specified instead of the standard
FRONT_VIEW in line 39.
Search WWH ::

Custom Search