This is the code I use to create the HUD:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| PlatformGeometry hudPlatformGeometry = new PlatformGeometry(); hudPlatformGeometry.setCapability(PlatformGeometry.ALLOW_CHILDREN_WRITE); hudPlatformGeometry.setCapability(PlatformGeometry.ALLOW_CHILDREN_READ); hudPlatformGeometry.setCapability(PlatformGeometry.ALLOW_CHILDREN_EXTEND);
GraphicsConfigTemplate3D gTempl3D = new GraphicsConfigTemplate3D(); gTempl3D.setDoubleBuffer(GraphicsConfigTemplate3D.PREFERRED); gTempl3D.setSceneAntialiasing(GraphicsConfigTemplate3D.PREFERRED); gTempl3D.setStereo(GraphicsConfigTemplate3D.PREFERRED); GraphicsConfiguration graphicsConfig = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getBestConfiguration(gTempl3D);
Canvas3D aCanvas = new Canvas3D(graphicsConfig);
PhysicalHUD hud = new PhysicalHUD(MAX_NUM_OF_HUD_LAYERS, aCanvas3D, hudPlatformGeometry, 4f);
Viewer ptiViewer = new Viewer(aCanvas); ViewingPlatform ptiPlatform = new ViewingPlatform(); ptiViewer.setViewingPlatform(ptiPlatform);
ptiPlatform.setPlatformGeometry(hudPlatformGeometry); |
After this I just add the ViewingPlatform to my scene graph. Please let me know if you require further clarification. Thank-you.