Show Posts
|
|
Pages: [1]
|
|
1
|
Java Game APIs & Engines / Java 3D / Re: IDE doesn't found package
|
on: 2003-01-10 11:43:41
|
|
Hi,
In the meentime I've checked the including with some other examples and found no differences in the line com.sun.j3d.utils.universe.
I still get errors within the code - One error with wrong startingpoint in the for-loorp and different error relating with the above mentioned including and an error within the startingprocedure. A class is wanted that was the content of the message.
Here my code:
import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.universe.*; import javax.media.j3d.*; import javax.vecmath.*;
public class Position extends applet{ SimpleUniverse universe = new SimpleUniverse(); BranchGroup group = new BranchGroup();
//x-axis made of sphere
for (float x =-1.0f;x <= 1.0f;x=x+ 0.1f) { Sphere sphere = new Sphere(0.5f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(x,-0.f,0.f); transform.setTranslation(vector); tg.addChild(sphere); group.addChild(tg); }
//y-axis made of cones //y-axis made of cones
for (float y=-1.0f;y<=1.0f;y=y+0.1f) { Cone cone = new Cone(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(cone); group.addChild(tg); }
//z-axis made of zylinders
for (float z=1.0f; z<=1.0f; z = z+0.1f) { Cylinder cylinder = new Cylinder(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(sphere); group.addChild(tg); }
//y-axis made of cones
for (float y=-1.0f;y<=1.0f;y=y+0.1f) { Cone cone = new Cone(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(cone); group.addChild(tg); }
//z-axis made of zylinders
for (float z=1.0f; z<=1.0f; z = z+0.1f) { Cylinder cylinder = new Cylinder(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(cone); group.addChild(tg); }
Color3f light1Color = new Color3f(.1f,1.4f,.1f); // green light BoundingSphere bounds = new BoundingSphere(new Point3D(0.0,0.0,0.0),100); Vector3f light1Direction = new Vector3f(4.0f,-7.0f,-12.0f); DirectionalLight light1 = new DirectionalLight(light1Color,lightDirection); light1.setInfluencingBounds(bounds); group.addChild(light1); universe.getViewingPlatform().setNominalViewingTransform(); //add the group of objects to the Universe
universe.addBranchGraph(group); }
public Position();
}
|
|
|
|
|
2
|
Java Game APIs & Engines / Java 3D / Re: IDE doesn't found package
|
on: 2003-01-10 07:38:53
|
|
Hi,
to ensure that we aren't talking about different. The problem is that netbeans can't import com.sun.j3d.utils.universe.*. Related classes there are installed in the the path posted last and the under directories.
I also try if there is a possibility with the jarfile(s).
Regards, Ruprecht
|
|
|
|
|
3
|
Java Game APIs & Engines / Java 3D / IDE doesn't found package
|
on: 2003-01-09 18:03:29
|
|
Hi,
I'm trying out the Positionexample of the java3d-tutorial. By the compiling of the code I get some errors. One of it is that the package com.sun.j3d.utils.universe.* can not included into the source.
I'm using netbeans in the linuxversion with jsdk 1.4.0_02. Files that can be related to the packages there are under /usr/java/j2sdk1.4.0_02/jre/ext/... Is this the right directory for the sun-j3d-components or have I to install these files to another directory. Normaly netbeans suggest parameters to complete the commands. The java3d related stuff are not suggested.
Regards, Ruprecht
|
|
|
|
|
5
|
Java Game APIs & Engines / Java 3D / Re: Problem by runing Applet
|
on: 2003-01-04 10:42:18
|
|
Hi Elias,
thank you for the quick answer. You are right I missed this part. Now it is shown in my ide. Only one question I do have. How can I build a continous rotation around the x-axis. The interpolator by default turns around the y-axis.
Regards, Ruprecht
|
|
|
|
|
6
|
Java Game APIs & Engines / Java 3D / Re: Problem by runing Applet
|
on: 2003-01-04 09:03:44
|
|
OK I tried xhost + <hostname>. The result I get no errormessage(s) but I become no output. Elias could have been right in this sentence that the code is not a normal applet. I have heard that j3d works with applets to output the result. In the case of E. I don't understand why in the public line you write extends applet.
The whole sourcecode of my script I posted in the german posting (beginn of thread). What can be that I get no result is that the returncommand is written in this form
return objRoot; and not return(objRoot);
Regards, Ruprecht
|
|
|
|
|
7
|
Java Game APIs & Engines / Java 3D / Re: Problem by runing Applet
|
on: 2003-01-03 12:36:50
|
|
Hi Elias,
you are right my first test was with the same user logged into X. By using the sux-command the command gives no errormessage but I couldn't get an applet. Running it under netscape it have trouble in initiate the applet. Here messages with sendingcommands are displayed. The problems with netscape are in all j3d-codes. The sun examples executed within the netbeans-ide were executed correctly (HelloUniverse, 3D-Text, mouseturnable polygon).
Regards, Ruprecht
|
|
|
|
|
8
|
Java Game APIs & Engines / Java 3D / Re: Problem by runing Applet
|
on: 2003-01-03 12:36:35
|
|
Hi Elias,
you are right my first test was with the same user logged into X. By using the sux-command the command gives no errormessage but I couldn't get an applet. Running it under netscape it have trouble in initiate the applet. Here messages with sendingcommands are displayed. The problems with netscape are in all j3d-codes. The sun examples executed within the netbeans-ide were executed correctly (HelloUniverse, 3D-Text, mouseturnable polygon).
Regards, Ruprecht
|
|
|
|
|
9
|
Java Game APIs & Engines / Java 3D / Re: Problem by runing Applet
|
on: 2003-01-03 09:18:37
|
|
Hi Elias,
thanks for the quick answer. I tried the following with this result
linux:/usr/java/j2sdk1.4.0_02/bin # ./appletviewer HelloUniverse4.html Xlib: connection to ":0.0" refused by server Xlib: Client is not authorized to connect to Server Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:126) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:130) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62) at java.awt.Window.init(Window.java:223) at java.awt.Window.<init>(Window.java:267) at java.awt.Frame.<init>(Frame.java:398) at java.awt.Frame.<init>(Frame.java:363) at sun.applet.AppletViewer.<init>(AppletViewer.java:139) at sun.applet.StdAppletViewerFactory.createAppletViewer(AppletViewer.java:80) at sun.applet.AppletViewer.parse(AppletViewer.java:1062) at sun.applet.AppletViewer.parse(AppletViewer.java:996) at sun.applet.Main.run(Main.java:138) at sun.applet.Main.main(Main.java:80)
Regards, ruprecht
|
|
|
|
|
10
|
Java Game APIs & Engines / Java 3D / Re: Problem by runing Applet
|
on: 2003-01-02 19:09:48
|
|
Hi,
sorry I have posted my message before I've seen that it was an english webforum. OK here the english translation. The Code in my first posting is the axample for rotatiing a ColorCube araound two axis. The Compiling and Building acts without any problem. On Running the applet I get only a statusline-message that the applet is starting.
What can be the problem that the cube will not be displayeed and I can't see any rotation.
Regards, Ruprecht
|
|
|
|
|
11
|
Java Game APIs & Engines / Java 3D / Problem by runing Applet
|
on: 2003-01-02 18:45:02
|
|
Hi,
Ich habe mich an einem Beispielapplet zur Rotation eines Farbwüürfels um 2 Achsen probiert. Compilieren und Builden ging ohne Probleme, allerdings wird mir das Applet nicht richtig aufgebaut. Es wird nur gemeldet, dass das applet gestartet wurde.
Der Code sieht wie folgt aus:
import java.applet.Applet; import java.awt.BorderLayout; import java.awt.event.*; import java.awt.GraphicsConfiguration; import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.geometry.ColorCube; import com.sun.j3d.utils.universe.*; import javax.media.j3d.*; import javax.vecmath.*;
public class HelloUniverse4 extends Applet {
private SimpleUniverse u = null;
public BranchGroup createSceneGraph() { BranchGroup objRoot = new BranchGroup();
//rotate object has composite transformation matrix Transform3D rotate =new Transform3D(); Transform3D tempRotate =new Transform3D();
rotate.rotX(Math.PI/4.0d); tempRotate.rotY(Math.PI/5.0d); rotate.mul(tempRotate);
TransformGroup objRotate =new TransformGroup(rotate);
//Create the transform group node and initialize it to the //identity.Enable the TRANSFORM_WRITE capability so that //our behavior code can modify it at runtime.Add it to the //root of the subgraph. TransformGroup objSpin =new TransformGroup(); objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objRotate); objRotate.addChild(objSpin);
//Create a simple shape leaf node,add it to the scene graph. //ColorCube is a Convenience Utility class objSpin.addChild(new ColorCube(0.4));
//Create a new Behavior object that performs the desired //operation on the specified transform object and add it into //the scene graph. Transform3D yAxis =new Transform3D(); Alpha rotationAlpha =new Alpha(-1,4000);
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha,objSpin,yAxis, 0.0f,(float)Math.PI*2.0f);
//a bounding sphere specifies a region a behavior is active //create a sphere centered at the origin with radius of 1 BoundingSphere bounds =new BoundingSphere(); rotator.setSchedulingBounds(bounds); objSpin.addChild(rotator);
return objRoot; } } //end of createSceneGraph method of HelloJava3Dd
Gruss Ruprecht
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|