Search Results

Search found 7 results on 1 pages for 'j3d'.

Page 1/1 | 1 

  • Managing the layout of a Java MainFrame of Canvas3d

    - by John N
    Hi, Im trying to organise the layout of four canvas3d objects in a single MainFrame. Iv tried using some layout managers but none are working (or im doing it wrong). Can anyone give me advice or point me to a way to get this to display the four canvas's as a grid of four? Thanks, John public class Main { public static void Main(){ Window win = new Window(); } } import javax.media.j3d.BranchGroup; import javax.media.j3d.Canvas3D; import javax.media.j3d.Locale; import javax.media.j3d.PhysicalBody; import javax.media.j3d.PhysicalEnvironment; import javax.media.j3d.Transform3D; import javax.media.j3d.TransformGroup; import javax.media.j3d.View; import javax.media.j3d.ViewPlatform; import javax.media.j3d.VirtualUniverse; import javax.vecmath.Vector3f; import com.sun.j3d.utils.picking.PickCanvas; public class Universe { boolean camera = true; Canvas3D canvas1, canvas2, canvas3, canvas4; VirtualUniverse universe; Locale locale; TransformGroup vpTrans1, vpTransRight, vpTransFront, vpTransPers; TransformGroup mouseTransform = null; View view1, view2, view3, view4; BranchGroup scene; PickCanvas pickCanvas1 = null; PickCanvas pickCanvas2 = null; PickCanvas pickCanvas3 = null; PickCanvas pickCanvas4 = null; BranchGroup obj = new BranchGroup(); // Create a BranchGroup node for the view platform BranchGroup vpRoot = new BranchGroup(); //Temp vars for cam movement public Universe(Canvas3D c1, Canvas3D c2, Canvas3D c3, Canvas3D c4, BranchGroup scene) { this.canvas1 = c1; this.canvas2 = c2; this.canvas3 = c3; this.canvas4 = c4; this.scene = scene; // Establish a virtual universe that has a single // hi-res Locale universe = new VirtualUniverse(); locale = new Locale(universe); // Create a PhysicalBody and PhysicalEnvironment object PhysicalBody body = new PhysicalBody(); PhysicalEnvironment environment = new PhysicalEnvironment(); // Create a View and attach the Canvas3D and the physical // body and environment to the view. view1 = new View(); view1.addCanvas3D(c1); view1.addCanvas3D(c2); view1.addCanvas3D(c3); view1.addCanvas3D(c4); view1.setPhysicalBody(body); view1.setPhysicalEnvironment(environment); // Create a BranchGroup node for the view platform BranchGroup vpRoot = new BranchGroup(); // Create a ViewPlatform object, and its associated // TransformGroup object, and attach it to the root of the // subgraph. Attach the view to the view platform. Transform3D t = new Transform3D(); t.set(new Vector3f(0.0f, 0.0f, 2.0f)); ViewPlatform vp = new ViewPlatform(); vpTrans1 = new TransformGroup(t); vpTrans1.addChild(vp); vpRoot.addChild(vpTrans1); vpRoot.addChild(scene); view1.attachViewPlatform(vp); // Attach the branch graph to the universe, via the // Locale. The scene graph is now live! locale.addBranchGraph(vpRoot); } } import javax.media.j3d.BranchGroup; import javax.media.j3d.Canvas3D; import javax.media.j3d.Locale; import javax.media.j3d.PhysicalBody; import javax.media.j3d.PhysicalEnvironment; import javax.media.j3d.Transform3D; import javax.media.j3d.TransformGroup; import javax.media.j3d.View; import javax.media.j3d.ViewPlatform; import javax.media.j3d.VirtualUniverse; import javax.vecmath.Vector3f; import com.sun.j3d.utils.picking.PickCanvas; public class Universe { boolean camera = true; Canvas3D canvas1, canvas2, canvas3, canvas4; VirtualUniverse universe; Locale locale; TransformGroup vpTrans1, vpTransRight, vpTransFront, vpTransPers; TransformGroup mouseTransform = null; View view1, view2, view3, view4; BranchGroup scene; PickCanvas pickCanvas1 = null; PickCanvas pickCanvas2 = null; PickCanvas pickCanvas3 = null; PickCanvas pickCanvas4 = null; BranchGroup obj = new BranchGroup(); // Create a BranchGroup node for the view platform BranchGroup vpRoot = new BranchGroup(); //Temp vars for cam movement public Universe(Canvas3D c1, Canvas3D c2, Canvas3D c3, Canvas3D c4, BranchGroup scene) { this.canvas1 = c1; this.canvas2 = c2; this.canvas3 = c3; this.canvas4 = c4; this.scene = scene; // Establish a virtual universe that has a single // hi-res Locale universe = new VirtualUniverse(); locale = new Locale(universe); // Create a PhysicalBody and PhysicalEnvironment object PhysicalBody body = new PhysicalBody(); PhysicalEnvironment environment = new PhysicalEnvironment(); // Create a View and attach the Canvas3D and the physical // body and environment to the view. view1 = new View(); view1.addCanvas3D(c1); view1.addCanvas3D(c2); view1.addCanvas3D(c3); view1.addCanvas3D(c4); view1.setPhysicalBody(body); view1.setPhysicalEnvironment(environment); // Create a BranchGroup node for the view platform BranchGroup vpRoot = new BranchGroup(); // Create a ViewPlatform object, and its associated // TransformGroup object, and attach it to the root of the // subgraph. Attach the view to the view platform. Transform3D t = new Transform3D(); t.set(new Vector3f(0.0f, 0.0f, 2.0f)); ViewPlatform vp = new ViewPlatform(); vpTrans1 = new TransformGroup(t); vpTrans1.addChild(vp); vpRoot.addChild(vpTrans1); vpRoot.addChild(scene); view1.attachViewPlatform(vp); // Attach the branch graph to the universe, via the // Locale. The scene graph is now live! locale.addBranchGraph(vpRoot); } }

    Read the article

  • Why am I getting ClassNotFoundExpection when I have properly imported said class and am looking at it in its directory?

    - by Strider
    This is my Javac compiling statement: javac -cp "C:\java\code\j3D\j3dcore.jar;C:\java\code\j3D\j3dutils.jar;C:\java\code\j3D\vecmath.jar" Simple.java compiles with no problems. The three jar files (j3dcore, j3dutils, and vecmath) are the essential jar's for my program (or at least I am led to believe according to this official tutorial on J3D For the record I ripped this code almost line from line from this pdf file. jar files are correctly located in referenced locations When I run my Simple program, (java Simple) I am greeted with Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/Cavas3d Caused by: java.lang.ClassNotFoundExpection: javax.media.j3d.Canvas3D Currently I am staring directly at this Canvas3D.class that is located within j3dcore.jar\javax\media\j3d\ wtfisthis.jpg Here is the source code: //First java3D Program import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.event.*; import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.universe.*; import com.sun.j3d.utils.geometry.ColorCube; import javax.media.j3d.*; import javax.vecmath.*; import java.awt.GraphicsConfiguration; public class Simple extends Applet { public Simple() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D canvas3D = new Canvas3D(config); add("Center", canvas3D); BranchGroup scene = createSceneGraph(); scene.compile(); // SimpleUniverse is a Convenience Utility class SimpleUniverse simpleU = new SimpleUniverse(canvas3D); // This moves the ViewPlatform back a bit so the // objects in the scene can be viewed. simpleU.getViewingPlatform().setNominalViewingTransform(); simpleU.addBranchGraph(scene); } // end of HelloJava3Da (constructor) public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // Create a simple shape leaf node, add it to the scene graph. // ColorCube is a Convenience Utility class objRoot.addChild(new ColorCube(0.4)); return objRoot; } public static void main(String args[]){ Simple world = new Simple(); } }` Did I import correctly? Did I incorrectly reference my jar files in my Javac statement? If I clearly see Canvas3D within its correct directory why cant java find it? The first folder in both j3dcore.jar and vecmath.jar is "javax". Is the compiler getting confused? If the compiler is getting confused how do I specify where to find that exact class when referencing it within my source code?

    Read the article

  • Installing Java3D on Eclipse

    - by Matt
    I'm trying to use Java3D in my project. This is the error I receive: 29-Dec-2010 1:01:29 AM javax.media.j3d.NativePipeline getSupportedOglVendor SEVERE: java.lang.UnsatisfiedLinkError: no j3dcore-ogl-chk in java.library.path Exception in thread "main" java.lang.UnsatisfiedLinkError: no j3dcore-d3d in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at javax.media.j3d.NativePipeline$1.run(NativePipeline.java:189) at java.security.AccessController.doPrivileged(Native Method) at javax.media.j3d.NativePipeline.loadLibrary(NativePipeline.java:180) at javax.media.j3d.NativePipeline.loadLibraries(NativePipeline.java:137) at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:948) at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280) at World.<init>(World.java:10) at Start.main(Start.java:12) I have copied the .jar files into my project's lib folder and linked them in Project - Properties - Add Jar File. There was also a .dll file in the Java3D download that I haven't touched or included in any way. What am I missing?

    Read the article

  • How do I fix SweetHome3d?

    - by GOOD_GUY
    This is what I get in Terminal. I hope this helps. If not, let me know what I need to provide. Thanks sweethome3d [warning] /usr/bin/sweethome3d: Unable to locate /usr/lib/jvm/java-6-sun/jre/lib/javaws.jar in /usr/share/java Exception in thread "main" java.lang.ExceptionInInitializerError at com.eteks.sweethome3d.j3d.Component3DManager$RenderingErrorListenerManager.setRenderingErrorObserver(Unknown Source) at com.eteks.sweethome3d.j3d.Component3DManager.setRenderingErrorObserver(Unknown Source) at com.eteks.sweethome3d.SweetHome3D.addComponent3DRenderingErrorObserver(Unknown Source) at com.eteks.sweethome3d.SweetHome3D.init(Unknown Source) at com.eteks.sweethome3d.SweetHome3D.main(Unknown Source) Caused by: java.awt.HeadlessException at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:294) ... 5 more

    Read the article

  • How to implement a hub in Python

    - by j3d
    Dear all, I need to implement a TCP server in Python which receives some data from a client and then sends this data to another client. I've tried many different implementations but no way to make it run. Any help would be really appreciated.

    Read the article

  • Rotation of viewplatform in Java3D

    - by user29163
    I have just started with Java3D programming. I thought I had built up some basic intuition about how the scene graph works, but something that should work, does not work. I made a simple program for rotating a pyramid around the y-axis. This was done just by adding a RotationInterpolator R to the TransformGroup above the pyramid. Then I thought hey, can I now remove the RotationInterpolator from this TransformGroup, then add it to the TransformGroup above my ViewPlatform leaf. This should work if I have understood how things work. Adding the RotationInterpolator to this TransformGroup, should make the children of this TransformGroup rotate, and the ViewingPlatform is a child of the TransformGroup. Any ideas on where my reasoning is flawed? Here is the code for setting up the universe, and the view branchgroup. import java.awt.*; import java.awt.event.*; import javax.media.j3d.*; import javax.vecmath.*; public class UniverseBuilder { // User-specified canvas Canvas3D canvas; // Scene graph elements to which the user may want access VirtualUniverse universe; Locale locale; TransformGroup vpTrans; View view; public UniverseBuilder(Canvas3D c) { this.canvas = c; // Establish a virtual universe that has a single // hi-res Locale universe = new VirtualUniverse(); locale = new Locale(universe); // Create a PhysicalBody and PhysicalEnvironment object PhysicalBody body = new PhysicalBody(); PhysicalEnvironment environment = new PhysicalEnvironment(); // Create a View and attach the Canvas3D and the physical // body and environment to the view. view = new View(); view.addCanvas3D(c); view.setPhysicalBody(body); view.setPhysicalEnvironment(environment); // Create a BranchGroup node for the view platform BranchGroup vpRoot = new BranchGroup(); // Create a ViewPlatform object, and its associated // TransformGroup object, and attach it to the root of the // subgraph. Attach the view to the view platform. Transform3D t = new Transform3D(); Transform3D s = new Transform3D(); t.set(new Vector3f(0.0f, 0.0f, 10.0f)); t.rotX(-Math.PI/4); s.set(new Vector3f(0.0f, 0.0f, 10.0f)); //forandre verdier her for å endre viewing position t.mul(s); ViewPlatform vp = new ViewPlatform(); vpTrans = new TransformGroup(t); vpTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); // Rotator stuff Transform3D yAxis = new Transform3D(); //yAxis.rotY(Math.PI/2); Alpha rotationAlpha = new Alpha( -1, Alpha.INCREASING_ENABLE, 0, 0,4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator( rotationAlpha, vpTrans, yAxis, 0.0f, (float) Math.PI*2.0f); RotationInterpolator rotator2 = new RotationInterpolator( rotationAlpha, vpTrans); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 1000.0); rotator.setSchedulingBounds(bounds); vpTrans.addChild(rotator); vpTrans.addChild(vp); vpRoot.addChild(vpTrans); view.attachViewPlatform(vp); // Attach the branch graph to the universe, via the // Locale. The scene graph is now live! locale.addBranchGraph(vpRoot); } public void addBranchGraph(BranchGroup bg) { locale.addBranchGraph(bg); } }

    Read the article

  • Trouble rotating viewplatform in Java3D [closed]

    - by user29163
    I have just started with Java3D programming. I thought I had built up some basic intuition about how the scene graph works, but something that should work, does not work. I made a simple program for rotating a pyramid around the y-axis. This was done just by adding a RotationInterpolator R to the TransformGroup above the pyramid. Then I thought hey, can I now remove the RotationInterpolator from this TransformGroup, then add it to the TransformGroup above my ViewPlatform leaf. This should work if I have understood how things work. Adding the RotationInterpolator to this TransformGroup, should make the children of this TransformGroup rotate, and the ViewingPlatform is a child of the TransformGroup. Any ideas on where my reasoning is flawed? Here is the code for setting up the universe, and the view branchgroup. import java.awt.*; import java.awt.event.*; import javax.media.j3d.*; import javax.vecmath.*; public class UniverseBuilder { // User-specified canvas Canvas3D canvas; // Scene graph elements to which the user may want access VirtualUniverse universe; Locale locale; TransformGroup vpTrans; View view; public UniverseBuilder(Canvas3D c) { this.canvas = c; // Establish a virtual universe that has a single // hi-res Locale universe = new VirtualUniverse(); locale = new Locale(universe); // Create a PhysicalBody and PhysicalEnvironment object PhysicalBody body = new PhysicalBody(); PhysicalEnvironment environment = new PhysicalEnvironment(); // Create a View and attach the Canvas3D and the physical // body and environment to the view. view = new View(); view.addCanvas3D(c); view.setPhysicalBody(body); view.setPhysicalEnvironment(environment); // Create a BranchGroup node for the view platform BranchGroup vpRoot = new BranchGroup(); // Create a ViewPlatform object, and its associated // TransformGroup object, and attach it to the root of the // subgraph. Attach the view to the view platform. Transform3D t = new Transform3D(); Transform3D s = new Transform3D(); t.set(new Vector3f(0.0f, 0.0f, 10.0f)); t.rotX(-Math.PI/4); s.set(new Vector3f(0.0f, 0.0f, 10.0f)); //forandre verdier her for å endre viewing position t.mul(s); ViewPlatform vp = new ViewPlatform(); vpTrans = new TransformGroup(t); vpTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); // Rotator stuff Transform3D yAxis = new Transform3D(); //yAxis.rotY(Math.PI/2); Alpha rotationAlpha = new Alpha( -1, Alpha.INCREASING_ENABLE, 0, 0,4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator( rotationAlpha, vpTrans, yAxis, 0.0f, (float) Math.PI*2.0f); RotationInterpolator rotator2 = new RotationInterpolator( rotationAlpha, vpTrans); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 1000.0); rotator.setSchedulingBounds(bounds); vpTrans.addChild(rotator); vpTrans.addChild(vp); vpRoot.addChild(vpTrans); view.attachViewPlatform(vp); // Attach the branch graph to the universe, via the // Locale. The scene graph is now live! locale.addBranchGraph(vpRoot); } public void addBranchGraph(BranchGroup bg) { locale.addBranchGraph(bg); } }

    Read the article

1