如何在Java3D中设置宇宙的功能?
如何设置使用canvas3d对象创建的SimpleUniverse实例的边界 我尝试了下面的代码,但是如果我尝试设置边界,我会得到一个“Capability not set exception”,如果我尝试设置写边界的功能,我会得到一个“Restricted access exception” 这是我的密码:如何在Java3D中设置宇宙的功能?,java,opengl,graphics,java-3d,Java,Opengl,Graphics,Java 3d,如何设置使用canvas3d对象创建的SimpleUniverse实例的边界 我尝试了下面的代码,但是如果我尝试设置边界,我会得到一个“Capability not set exception”,如果我尝试设置写边界的功能,我会得到一个“Restricted access exception” 这是我的密码: GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D canvas3d =
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3d = new Canvas3D(config);
SimpleUniverse universe = new SimpleUniverse(canvas3d);
ViewingPlatform viewPlatform = universe.getViewingPlatform();
// Below line throws RestricedAccessException
viewPlatform.setCapability(ViewingPlatform.ALLOW_BOUNDS_WRITE);
// I want to set the bounds, thus the need for the capability above
viewPlatform.setBounds(bounds);
请帮忙 我明白了。而不是像这样建立宇宙:
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3d = new Canvas3D(config);
SimpleUniverse universe = new SimpleUniverse(canvas3d);
我自己设置了查看平台
,然后用它创建了宇宙:
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3d = new Canvas3D(config);
ViewingPlatform viewingPlatform = new ViewingPlatform();
viewingPlatform.setCapability(ViewingPlatform.ALLOW_BOUNDS_WRITE);
viewingPlatform.setBounds(bounds);
Viewer viewer = new Viewer(canvas3d);
SimpleUniverse universe = new SimpleUniverse(viewingPlatform, viewer);