why creating sphere(6378f,Primitive.GENERATE_TEXTURE_COORDS, 800, app) makes memory heap error? hmmm
I need to make earth sphere(6378.137,...., <2000?>,app) & make it possible to zoom in & still get nice view (round) Is there other way then using sphere to make it work? When im doing it on shere(637......) it warks but when i start zooming out texture stops to scale at some distance, how can i fix it?? (do i have to make more textures with different size and load them all to memory?, is there other way?) Any links to java3d sites with demo code will make me happy Thanks code: --------------------------------------------------------------------------- ----- Appearance createTwistAppearance(){ Appearance twistAppear = new Appearance(); String filename = "earth.jpg"; System.out.println("attempt to load texture from file: "+filename); TextureLoader loader = new TextureLoader(filename, this); ImageComponent2D image = loader.getImage(); if(image == null) { System.out.println("load failed for texture: "+filename); } Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getWidth(), image.getHeight()); texture.setImage(0, image); texture.setEnable(true); texture.setMagFilter(Texture.BASE_LEVEL_LINEAR); texture.setMinFilter(Texture.BASE_LEVEL_LINEAR); twistAppear.setTexture(texture); return twistAppear; } public BranchGroup createSceneGraph(SimpleUniverse su) { BranchGroup objRoot = new BranchGroup(); Appearance app = new Appearance(); TransformGroup TG = new TransformGroup(); TG.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE); objRoot.addChild(TG); Appearance appear = createTwistAppearance(); TG.addChild (new Sphere(637.8137f, Primitive.GENERATE_TEXTURE_COORDS,1000, appear)); Movement movement = new Movement(su); objRoot.addChild(movement.getMouseRotate()); objRoot.addChild(movement.getMouseTranslate()); objRoot.addChild(movement.getMouseZoom()); objRoot.addChild(movement.getKeyNavigator()); BoundingSphere bounds = new BoundingSphere(new Point3d(),10000); Background background = new Background(1.0f, 1.0f, 1.0f); background.setApplicationBounds(bounds); objRoot.addChild(background); objRoot.compile(); return objRoot; } public Ray3dApp(){ setLayout(new BorderLayout()); GraphicsConfiguration gConfig = SimpleUniverse.getPreferredConfiguration(); Canvas3D canvas3D = new Canvas3D(gConfig); add("Center",canvas3D); canvas3D.setStereoEnable(false); SimpleUniverse sUniverse = new SimpleUniverse(canvas3D); sUniverse.getViewingPlatform().setNominalViewingTransform(); BranchGroup scene = createSceneGraph(sUniverse); sUniverse.addBranchGraph(scene); } public static void main(String[] args) { Frame frame = new MainFrame(new Ray3dApp (), 600, 600); } public class Movement{ private BoundingSphere boundsSphere; private double bounds = 10000; private TransformGroup vpTrans = null; private MouseRotate mRotate; private MouseTranslate mTranslate; private MouseZoom mZoom; private KeyNavigatorBehavior kBehavior; public Movement(SimpleUniverse su){ boundsSphere = new BoundingSphere(new Point3d(), bounds); Transform3D T3D = new Transform3D(); Vector3f translate = new Vector3f(); vpTrans = su.getViewingPlatform ().getViewPlatformTransform(); translate.set( 0.0f, 0.0f, 690f); T3D.setTranslation(translate); vpTrans.setTransform(T3D); mRotate = new MouseRotate(MouseBehavior.INVERT_INPUT); mRotate.setTransformGroup(vpTrans); mRotate.setSchedulingBounds(boundsSphere); mTranslate = new MouseTranslate(/*MouseBehavior.INVERT_INPUT*/); mTranslate.setTransformGroup(vpTrans); mTranslate.setSchedulingBounds(boundsSphere); mZoom = new MouseZoom(MouseBehavior.INVERT_INPUT); mZoom.setFactor(1); mZoom.setTransformGroup(vpTrans); mZoom.setSchedulingBounds(boundsSphere); kBehavior = new KeyNavigatorBehavior(vpTrans); kBehavior.setSchedulingBounds(boundsSphere); } public MouseRotate getMouseRotate(){ return mRotate; } public MouseTranslate getMouseTranslate(){ return mTranslate; } public MouseZoom getMouseZoom(){ return mZoom; } public KeyNavigatorBehavior getKeyNavigator(){ return kBehavior; } =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".