List of usage examples for javax.media.j3d GraphicsConfigTemplate3D GraphicsConfigTemplate3D
public GraphicsConfigTemplate3D()
From source file:QueryProperties.java
public static void main(String[] args) { VirtualUniverse vu = new VirtualUniverse(); Map vuMap = vu.getProperties(); System.out.println("version = " + vuMap.get("j3d.version")); System.out.println("vendor = " + vuMap.get("j3d.vendor")); System.out.println("specification.version = " + vuMap.get("j3d.specification.version")); System.out.println("specification.vendor = " + vuMap.get("j3d.specification.vendor")); System.out.println("renderer = " + vuMap.get("j3d.renderer") + "\n"); GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D(); /*/*from ww w . j a va2 s . c om*/ * We need to set this to force choosing a pixel format that support the * canvas. */ template.setStereo(template.PREFERRED); template.setSceneAntialiasing(template.PREFERRED); GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getBestConfiguration(template); Map c3dMap = new Canvas3D(config).queryProperties(); System.out.println("Renderer version = " + c3dMap.get("native.version")); System.out.println("doubleBufferAvailable = " + c3dMap.get("doubleBufferAvailable")); System.out.println("stereoAvailable = " + c3dMap.get("stereoAvailable")); System.out.println("sceneAntialiasingAvailable = " + c3dMap.get("sceneAntialiasingAvailable")); System.out.println("sceneAntialiasingNumPasses = " + c3dMap.get("sceneAntialiasingNumPasses")); System.out.println("textureColorTableSize = " + c3dMap.get("textureColorTableSize")); System.out.println("textureEnvCombineAvailable = " + c3dMap.get("textureEnvCombineAvailable")); System.out.println("textureCombineDot3Available = " + c3dMap.get("textureCombineDot3Available")); System.out.println("textureCombineSubtractAvailable = " + c3dMap.get("textureCombineSubtractAvailable")); System.out.println("texture3DAvailable = " + c3dMap.get("texture3DAvailable")); System.out.println("textureCubeMapAvailable = " + c3dMap.get("textureCubeMapAvailable")); System.out.println("textureSharpenAvailable = " + c3dMap.get("textureSharpenAvailable")); System.out.println("textureDetailAvailable = " + c3dMap.get("textureDetailAvailable")); System.out.println("textureFilter4Available = " + c3dMap.get("textureFilter4Available")); System.out .println("textureAnisotropicFilterDegreeMax = " + c3dMap.get("textureAnisotropicFilterDegreeMax")); System.out.println("textureBoundaryWidthMax = " + c3dMap.get("textureBoundaryWidthMax")); System.out.println("textureWidthMax = " + c3dMap.get("textureWidthMax")); System.out.println("textureHeightMax = " + c3dMap.get("textureHeightMax")); System.out.println("textureLodOffsetAvailable = " + c3dMap.get("textureLodOffsetAvailable")); System.out.println("textureLodRangeAvailable = " + c3dMap.get("textureLodRangeAvailable")); System.out.println("textureUnitStateMax = " + c3dMap.get("textureUnitStateMax")); System.out.println( "compressedGeometry.majorVersionNumber = " + c3dMap.get("compressedGeometry.majorVersionNumber")); System.out.println( "compressedGeometry.minorVersionNumber = " + c3dMap.get("compressedGeometry.minorVersionNumber")); System.out.println("compressedGeometry.minorMinorVersionNumber = " + c3dMap.get("compressedGeometry.minorMinorVersionNumber")); System.exit(0); }
From source file:MixedTest.java
protected Canvas3D createCanvas3D() { // overidden this method to create a custom // Canvas3D that will implement the Immediate Mode rendering GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D(); gc3D.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED); GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); ImmediateCanvas3D c3d = new ImmediateCanvas3D(gd[0].getBestConfiguration(gc3D)); c3d.setSize(getCanvas3dWidth(c3d), getCanvas3dHeight(c3d)); return (Canvas3D) c3d; }
From source file:J3dSwingFrame.java
/** * Construct the test frame with a menubar and 3D canvas *///from ww w .j ava 2 s . c o m public J3dSwingFrame() { super("Java3D Tester"); // Disable lightweight menus JPopupMenu.setDefaultLightWeightPopupEnabled(false); JMenuBar menubar = new JMenuBar(); // File menu JMenu file_menu = new JMenu("File"); menubar.add(file_menu); close_menu = new JMenuItem("Exit"); close_menu.addActionListener(this); file_menu.add(close_menu); setJMenuBar(menubar); GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D(); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = env.getDefaultScreenDevice(); GraphicsConfiguration config = device.getBestConfiguration(template); canvas = new Canvas3D(config); // add the canvas to this frame. Since this is the only thing added to // the main frame we don't care about layout managers etc. getContentPane().add(canvas, "Center"); constructWorld(); setSize(600, 600); }
From source file:RasterTest.java
protected Canvas3D createCanvas3D() { // create a custom Canvas3D with postSwap overidden GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D(); gc3D.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED); GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); RasterCanvas3D c3d = new RasterCanvas3D(this, gd[0].getBestConfiguration(gc3D)); c3d.setSize(getCanvas3dWidth(c3d), getCanvas3dHeight(c3d)); return c3d;/*w w w . j a v a2 s .co m*/ }
From source file:Demo3D.java
/** * Constructor that allows to specify the desired initial instances. */// www .java 2 s .c o m public Demo3D() { // Set the best GraphicsConfiguration GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D(); GraphicsConfiguration graphConf = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getBestConfiguration(template); canvas3D = new Canvas3D(graphConf); // The used Canvas3D // Construction of the main frame. setTitle("Demo"); JPanel jMainPanel = new JPanel(true); jMainPanel.setLayout(new BorderLayout(0, 5)); // hor_gap and ver_gap JPanel jFpsPanel = new JPanel(true); jFpsPanel.setBackground(Color.white); jLabel = new JLabel(""); jLabel.setText("Wait for informations"); jFpsPanel.add(jLabel); jMainPanel.add(canvas3D, BorderLayout.CENTER); /* * // For the stereo-mode with an "Head Monted Display" (HMD). JPanel * jScene_Stereo_Panel = new JPanel(true); * jScene_Stereo_Panel.setLayout(new GridLayout(1, 2, 0, 0)); // rows, * col, hor_gap and ver_gap jScene_Stereo_Panel.add(canvas3D); * jScene_Stereo_Panel.add(canvas3D); * jMainPanel.add(jScene_Stereo_Panel, BorderLayout.CENTER); */ jMainPanel.add(jFpsPanel, BorderLayout.SOUTH); setContentPane(jMainPanel); // The ViewBranch class creates the instances of ViewPlatform, View, // etc. viewBr = new ViewBranch(canvas3D); fpsThread = new Thread(this); myScene(); }
From source file:SwingTest.java
/** * Create a Canvas3D.//from w w w.j a v a2 s . c o m * * @param offscreen * true to specify an offscreen canvas */ protected Canvas3D createCanvas3D(boolean offscreen) { GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D(); gc3D.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED); GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); Canvas3D c3d = new Canvas3D(gd[0].getBestConfiguration(gc3D), offscreen); c3d.setSize(500, 500); return c3d; }
From source file:PureImmediateStereo.java
public void init() { setLayout(new BorderLayout()); // Preferred to use Stereo GraphicsConfigTemplate3D gct = new GraphicsConfigTemplate3D(); gct.setStereo(GraphicsConfigTemplate3D.PREFERRED); GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getBestConfiguration(gct);/*from www . j a v a2 s. co m*/ canvas = new Canvas3D(config); Map map = canvas.queryProperties(); stereoSupport = canvas.getStereoAvailable(); if (stereoSupport) { System.out.println( "This machine support stereo, you should see a red cone on the left and green cone on the right."); // User can overide the above default behavior using // java3d property. String str = System.getProperty("j3d.sharedstereozbuffer", defaultSharedStereoZbuffer); sharedStereoZbuffer = (new Boolean(str)).booleanValue(); } else { System.out.println("Stereo is not support, you should only see the left red cone."); } if (!canvas.getDoubleBufferAvailable()) { System.out.println("Double buffer is not support !"); } // we must stop the Renderer in PureImmediate mode canvas.stopRenderer(); add("Center", canvas); // Create the universe and viewing branch u = new SimpleUniverse(canvas); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. u.getViewingPlatform().setNominalViewingTransform(); // Start a new thread that will continuously render (new Thread(this)).start(); }
From source file:MixedTest.java
protected Canvas3D createCanvas3D() { GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D(); gc3D.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED); GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); Canvas3D c3d = new Canvas3D(gd[0].getBestConfiguration(gc3D)); c3d.setSize(getCanvas3dWidth(c3d), getCanvas3dHeight(c3d)); return c3d;//from w w w . j a v a 2 s . co m }
From source file:ffx.ui.MainPanel.java
/** * <p>/*from w ww. jav a 2 s . c o m*/ * initialize</p> */ public void initialize() { if (init) { return; } init = true; String dir = System.getProperty("user.dir", FileSystemView.getFileSystemView().getDefaultDirectory().getAbsolutePath()); setCWD(new File(dir)); locale = new FFXLocale("en", "US"); JDialog splashScreen = null; ClassLoader loader = getClass().getClassLoader(); if (!GraphicsEnvironment.isHeadless()) { // Splash Screen JFrame.setDefaultLookAndFeelDecorated(true); splashScreen = new JDialog(frame, false); ImageIcon logo = new ImageIcon(loader.getResource("ffx/ui/icons/splash.png")); JLabel ffxLabel = new JLabel(logo); ffxLabel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); Container contentpane = splashScreen.getContentPane(); contentpane.setLayout(new BorderLayout()); contentpane.add(ffxLabel, BorderLayout.CENTER); splashScreen.setUndecorated(true); splashScreen.pack(); Dimension screenDimension = getToolkit().getScreenSize(); Dimension splashDimension = splashScreen.getSize(); splashScreen.setLocation((screenDimension.width - splashDimension.width) / 2, (screenDimension.height - splashDimension.height) / 2); splashScreen.setResizable(false); splashScreen.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); splashScreen.setVisible(true); // Make all pop-up Menus Heavyweight so they play nicely with Java3D JPopupMenu.setDefaultLightWeightPopupEnabled(false); } // Create the Root Node dataRoot = new MSRoot(); Border bb = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); statusLabel = new JLabel(" "); JLabel stepLabel = new JLabel(" "); stepLabel.setHorizontalAlignment(JLabel.RIGHT); JLabel energyLabel = new JLabel(" "); energyLabel.setHorizontalAlignment(JLabel.RIGHT); JPanel statusPanel = new JPanel(new GridLayout(1, 3)); statusPanel.setBorder(bb); statusPanel.add(statusLabel); statusPanel.add(stepLabel); statusPanel.add(energyLabel); if (!GraphicsEnvironment.isHeadless()) { GraphicsConfigTemplate3D template3D = new GraphicsConfigTemplate3D(); template3D.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getBestConfiguration(template3D); graphicsCanvas = new GraphicsCanvas(gc, this); graphicsPanel = new GraphicsPanel(graphicsCanvas, statusPanel); } // Initialize various Panels hierarchy = new Hierarchy(this); hierarchy.setStatus(statusLabel, stepLabel, energyLabel); keywordPanel = new KeywordPanel(this); modelingPanel = new ModelingPanel(this); JPanel treePane = new JPanel(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(hierarchy, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); treePane.add(scrollPane, BorderLayout.CENTER); tabbedPane = new JTabbedPane(); ImageIcon graphicsIcon = new ImageIcon(loader.getResource("ffx/ui/icons/monitor.png")); ImageIcon keywordIcon = new ImageIcon(loader.getResource("ffx/ui/icons/key.png")); ImageIcon modelingIcon = new ImageIcon(loader.getResource("ffx/ui/icons/cog.png")); tabbedPane.addTab(locale.getValue("Graphics"), graphicsIcon, graphicsPanel); tabbedPane.addTab(locale.getValue("KeywordEditor"), keywordIcon, keywordPanel); tabbedPane.addTab(locale.getValue("ModelingCommands"), modelingIcon, modelingPanel); tabbedPane.addChangeListener(this); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, treePane, tabbedPane); /* splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, treePane, graphicsPanel); */ splitPane.setResizeWeight(0.25); splitPane.setOneTouchExpandable(true); setLayout(new BorderLayout()); add(splitPane, BorderLayout.CENTER); if (!GraphicsEnvironment.isHeadless()) { mainMenu = new MainMenu(this); add(mainMenu.getToolBar(), BorderLayout.NORTH); getModelingShell(); loadPrefs(); SwingUtilities.updateComponentTreeUI(SwingUtilities.getRoot(this)); splashScreen.dispose(); } }
From source file:pl.edu.icm.visnow.geometries.viewer3d.Display3DPanel.java
/** * Creates new form Display3DPanel/* w ww.j a v a 2 s . c om*/ */ public Display3DPanel() { initComponents(); effectiveHeight = getHeight(); effectiveWidth = getWidth(); logger.debug("creating Display3DPanel"); this.setMinimumSize(new Dimension(200, 200)); this.setPreferredSize(new Dimension(800, 600)); GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D(); template.setStereo(GraphicsConfigTemplate3D.PREFERRED); // Get the GraphicsConfiguration that best fits our needs. logger.debug("getting config"); GraphicsConfiguration gcfg = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getBestConfiguration(template); logger.debug("creating canvas"); canvas = new Canvas3D(gcfg) { @Override public void postRender() { vGraphics = super.getGraphics2D(); vGraphics.setFont(new Font("sans-serif", Font.PLAIN, 10)); vGraphics.setColor(Color.YELLOW); locToWin.update(); fireProjectionChanged(new ProjectionEvent(this, locToWin)); draw2D(vGraphics, locToWin, effectiveWidth, effectiveHeight); vGraphics.flush(false); } @Override public void postSwap() { if (postRenderSilent || waitForExternalTrigger) { return; } if (!(storingJPEG || storingPNG || storingFrames)) { fireFrameRendered(); } if (storingFrames) { if (storingJPEG) { writeImage(new File(controlsPanel.getMovieCreationPanel().getCurrentFrameFileName())); } else { writeYUV(controlsPanel.getMovieCreationPanel().getGenericFrameFileName()); } } } }; canvas.setStereoEnable(false); add("Center", canvas); pickObject = new PickObject(canvas, objScene, rootObject.getGeometryObj(), objRotate); canvas.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { if (evt.isShiftDown()) { // if (e.isShiftDown()) // System.out.println(""+e.getX() + " " + e.getY()); } if (evt.getButton() == MouseEvent.BUTTON1) { if (evt.getClickCount() > 1) { reset(); } else if (pickObject.consumeEmulated3DPick(evt.getX(), evt.getY())) { /* Nothing must be done - everything was done in consumeEmulated3DPick() */ } else { pickObject.consume2DSelectModule(evt.getX(), evt.getY()); } rootObject.firePickChanged(evt, locToWin); } if (evt.getButton() == MouseEvent.BUTTON3) { if (getControlsFrame() != null) { getControlsFrame().setBounds(evt.getXOnScreen() - 130, evt.getYOnScreen(), 240, 500); getControlsFrame().setVisible(true); } else if (getTransientControlsFrame() != null) { getTransientControlsFrame().setBounds(evt.getXOnScreen() - 130, evt.getYOnScreen(), 240, 500); getTransientControlsFrame().setVisible(true); } else if (application != null) { application.getFrames().getGuiPanel().selectModule(name); } } if (evt.getButton() == MouseEvent.BUTTON2) { reset(); } } @Override public void mouseEntered(java.awt.event.MouseEvent evt) { mouseOn = true; mouseObserverThread = new Thread(new MouseObserver()); mouseObserverThread.start(); } @Override public void mouseExited(java.awt.event.MouseEvent evt) { mouseObserverThread = null; mouseOn = false; } }); canvas.addMouseMotionListener(new java.awt.event.MouseMotionListener() { @Override public void mouseDragged(MouseEvent e) { // if (e.isShiftDown()) // System.out.println(""+e.getX() + " " + e.getY()); } @Override public void mouseMoved(MouseEvent e) { } }); canvas.addMouseWheelListener(new java.awt.event.MouseWheelListener() { @Override public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) { rescaleFromMouseWheel(evt); } }); canvas.addKeyListener(new java.awt.event.KeyAdapter() { @Override public void keyTyped(KeyEvent evt) { formKeyTyped(evt); } @Override public void keyPressed(KeyEvent evt) { formKeyPressed(evt); } @Override public void keyReleased(KeyEvent evt) { formKeyReleased(evt); } }); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(true); universe = new SimpleUniverse(canvas); view = canvas.getView(); view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION); view.setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY); objScene.addChild(rootObject.getGeometryObj()); rootObject.setRenderingWindow(this); rootObject.getGeometryObj().setUserData(null); bg.setCapability(Background.ALLOW_COLOR_WRITE); bg.setCapability(Background.ALLOW_COLOR_READ); bg.setCapability(Background.ALLOW_IMAGE_WRITE); bg.setCapability(Background.ALLOW_IMAGE_READ); bg.setCapability(Background.ALLOW_IMAGE_SCALE_MODE_READ); bg.setCapability(Background.ALLOW_IMAGE_SCALE_MODE_WRITE); bg.setImageScaleMode(Background.SCALE_FIT_ALL); bg.setApplicationBounds(bounds); myFog.setCapability(LinearFog.ALLOW_DISTANCE_WRITE); myFog.setCapability(LinearFog.ALLOW_COLOR_WRITE); myFog.setInfluencingBounds(bounds); myFog.setFrontDistance(1.); myFog.setBackDistance(4.); myFogGroup.addChild(myFog); mouseRotate.setTransformGroup(objRotate); mouseRotate.setSchedulingBounds(bounds); mouseRotate.setFactor(mouseRotateSensitivity); mouseTranslate.setTransformGroup(objRotate); mouseTranslate.setSchedulingBounds(bounds); mouseTranslate.setFactor(mouseTranslateSensitivity); mouseZoom.setTransformGroup(objRotate); mouseZoom.setSchedulingBounds(bounds); windowRootObject.addChild(mouseRotate); windowRootObject.addChild(mouseTranslate); windowRootObject.addChild(mouseZoom); objTranslate.addChild(objScene); objScale.addChild(objTranslate); objRotate.addChild(bg); objRotate.addChild(objScale); windowRootObject.addChild(objRotate); ambientLight = new EditableAmbientLight(new Color3f(.25f, .25f, .25f), bounds, "ambient light", true); windowRootObject.addChild(ambientLight.getLight()); directionalLights.add(new EditableDirectionalLight(new Color3f(0.4f, 0.4f, 0.4f), new Vector3f(.1f, .08f, -.5f), bounds, "light 1", true, true)); directionalLights.add(new EditableDirectionalLight(new Color3f(0.2f, 0.15f, 0.1f), new Vector3f(-1.f, -0.4f, -.5f), bounds, "light 2", true, false)); directionalLights.add(new EditableDirectionalLight(new Color3f(0.1f, 0.1f, 0.15f), new Vector3f(0.f, 0.6f, -1.f), bounds, "light 3", true, false)); directionalLights.add(new EditableDirectionalLight(new Color3f(0.1f, 0.1f, 0.15f), new Vector3f(0.f, -0.6f, -1.f), bounds, "light 3", false, false)); for (int i = 0; i < directionalLights.size(); i++) { TransformGroup lightTransform = new TransformGroup(); lightTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); lightTransform.setName("light" + i + "Transform"); directionalLightTransforms.add(lightTransform); OpenBranchGroup lightGroup = new OpenBranchGroup(); EditableDirectionalLight light = directionalLights.get(i); lightGroup.addChild(light.getLight()); lightGroup.addChild(light.getBackLight()); lightTransform.addChild(lightGroup); windowRootObject.addChild(lightTransform); } modelClip.setCapability(ModelClip.ALLOW_ENABLE_READ); modelClip.setCapability(ModelClip.ALLOW_ENABLE_WRITE); modelClip.setCapability(ModelClip.ALLOW_PLANE_READ); modelClip.setCapability(ModelClip.ALLOW_PLANE_WRITE); modelClip.setInfluencingBounds(bounds); objScene.addChild(modelClip); pointLights .add(new EditablePointLight(new Color3f(0.4f, 0.4f, 0.4f), bounds, null, null, "light 1", false)); pointLights .add(new EditablePointLight(new Color3f(0.4f, 0.4f, 0.4f), bounds, null, null, "light 1", false)); pointLights .add(new EditablePointLight(new Color3f(0.4f, 0.4f, 0.4f), bounds, null, null, "light 1", false)); for (int i = 0; i < pointLights.size(); i++) { TransformGroup lightTransform = new TransformGroup(); lightTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); lightTransform.setName("light" + i + "Transform"); pointLightTransforms.add(lightTransform); OpenBranchGroup lightGroup = new OpenBranchGroup(); EditablePointLight light = pointLights.get(i); lightGroup.addChild(light.getLight()); lightTransform.addChild(lightGroup); windowRootObject.addChild(lightTransform); } alternateTransformObj.addChild(alternateRootObj); alternateTransormBranch.addChild(alternateTransformObj); windowRootObject.addChild(alternateTransormBranch); universe.getViewingPlatform().setNominalViewingTransform(); universe.addBranchGraph(windowRootObject); view.getPhysicalBody().getLeftEyePosition(defaultLeftEye); view.getPhysicalBody().getRightEyePosition(defaultRightEye); controlsFrame = new Display3DControlsFrame(this); controlsPanel = controlsFrame.getControlPanel(); universe.getViewingPlatform().getViewPlatformTransform().getTransform(initialCameraTransform); objReper.addChild(reper.getGeometryObj()); positionedReper.addChild(objReper); positionedReper.setTransform( new Transform3D(new float[] { .15f, 0, 0, -.8f, 0, .15f, 0, .76f, 0, 0, .15f, 0, 0, 0, 0, 1 })); reperGroup.addChild(positionedReper); OpenBranchGroup reperLightGroup = new OpenBranchGroup(); reperLightGroup.addChild(new AmbientLight(new Color3f(.6f, .6f, .6f))); reperLightGroup.addChild(new EditableDirectionalLight(new Color3f(0.4f, 0.4f, 0.4f), new Vector3f(.1f, .08f, -1f), bounds, "light 1", true, true).getLight()); reperGroup.addChild(reperLightGroup); universe.addBranchGraph(reperGroup); locToWin = new LocalToWindow(rootObject.getGeometryObj(), canvas); /** * The line below binds reper with scene rotation when using any method that calls * objRotate.setTransform(), so: keyboard (explicitly calling), mouse (Java3D is calling * setTransform) and some custom ways (e.g. in haptic pointer) */ objRotate.addTransformListener(objReper); // mouseRotate.setupCallback(objReper); // it is not needed, because Java3D calls objRotate.setTranform which fires callback to the reper }