Skip to main content

Beginner's Doubts

33 replies [Last post]
Anonymous

Gentleman,

I just started in Java3D programming and i have 3 doubts to you may answer, please:

1. Is there any actual commercial project using Java3D? For example, a game project? How is the Java3D current overall status in virtual reality commercial world? There's any better option in this market niche?

2. Are there any "Java3D Certification"? In case of a positive answer, may you give some details about it?

3. Now a program problem. I wasn't able to create a program to create two bike wheels. Everything works corretly, but i have to put a Transform Group inside of another one. One is the normal one, used to rotate in Z axis. The other, however, is used to put in the correct translation. If i use only one, after rotate the first time, the whells go to point (0, 0, 0). I now that the compile method fits it, but without this, my program's initialization receive a bonus of about 50% in time. So, i would like to know if there's a way to fix it without the compile method and if the compile method is really useful in the end...

Embraces,
Waocnek

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aces
Offline
Joined: 2003-07-17

> Is there any program like 3D Studio that works with Java3D?

Java3D can load 3ds scenes, using a loader, but a tool to load java3D scenes inside 3DStudio is not avaiable yet.

messengers
Offline
Joined: 2004-04-18

>Is there any program like 3D Studio that works with Java3D
I use Poser a little. That exports .ojb files.
s

Anonymous

Glentleman, thanks for the information. I'm having a serious problem with my current program development. The question is:

- I need a Frame-like program that initiate full black in it content pane, with the capacity to take off this black color and put a 3D Scene when the user press a key, like "Enter" or "Space".

What i did:

- I used a JFrame with a JPanel with black bakground. A KeyAdapter class's child manage the keyboard events. When some of this events happens, it remove the initial JPanel and put a new one with the Scene, then repaint the JFrame.

What is wrong:

- The JPanel with the Scene doesn't appear.

What i discovered:

- When i remove the code that inserts the canvas, simple universe etc, and put a green bakground, it appears.

Do you know what's going on? Do you have any example code using JPanel (it's my first code with that, i always used mainframe) to me compare with my code?

kcr
Offline
Joined: 2004-03-17

> Do you know what's going on? Do you have any example code using JPanel (it's my first code
> with that, i always used mainframe) to me compare with my code?

We have several test programs that use a Canvas3D within a JPanel. Most are associated with filed issues and are listed in:

http://wiki.java.net/bin/view/Javadesktop/Java3DTestPrograms

A good one to start with might be issue 85 or issue 144. If you want one that uses multiple canvases, try issue 84.

-- Kevin

Brian McCormick

Hello,

Let's say you first construct object B and construct a class A inside it.
You can then pass object B's version of A into object C's constructor (via
an accessor methods of object B that returns object A) and then set object
C's version of A to the incoming object B's version of A.

Brian

-----Original Message-----
From: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Sent: Monday, September 05, 2005 11:12 AM
To: interest@java3d.dev.java.net
Subject: Re: Beginner's Doubts

Is there any way to a object from a class always be the same? I mean, if i
create a object of class A in the class B and then create another A-object
in class C, what i have to do to all A-objects be the same and not two
distint objects?

Waocnek
---
[Message sent by forum member 'Waocnek' (Brunno Silva)]

http://www.javadesktop.org/forums/thread.jspa?messageID=111426&#111426

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Ben Moxon

Or just create A as a singleton.

I'm wondering whether this is a question about object orientation or
about geometry sharing.

It is possible to use shared Geometry in Java3D, so that if you have
three different objects all of which use the same model you can re-use
one set of geometry rather than having to load in and carry the same
thing in memory three times.

-ben

-----Original Message-----
From: Brian McCormick [mailto:bmccormick@elmco.com]
Sent: 06 September 2005 14:52
To: interest@java3d.dev.java.net
Subject: RE: Beginner's Doubts

Hello,

Let's say you first construct object B and construct a class A inside
it.
You can then pass object B's version of A into object C's constructor
(via an accessor methods of object B that returns object A) and then set
object C's version of A to the incoming object B's version of A.

Brian

-----Original Message-----
From: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Sent: Monday, September 05, 2005 11:12 AM
To: interest@java3d.dev.java.net
Subject: Re: Beginner's Doubts

Is there any way to a object from a class always be the same? I mean, if
i create a object of class A in the class B and then create another
A-object in class C, what i have to do to all A-objects be the same and
not two distint objects?

Waocnek
---
[Message sent by forum member 'Waocnek' (Brunno Silva)]

http://www.javadesktop.org/forums/thread.jspa?messageID=111426&#111426

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Sami Dalouche

Hi,

what you are asking is a general java question, which is not specific to Java3D,
right ?

If you want to only have one instance of class A in your whole application, you
can use the "Singleton" design Pattern.

Basically :
class A {
private static A objA;

private A(){
// constructor
}

public static A getInstance(){
if (objA == null}
objA = new A();

return objA;
}

}

You can find more information about this design pattern on the web.

Regards,
Sami Dalouche
Selon java3d-interest@javadesktop.org:

> Is there any way to a object from a class always be the same? I mean, if i
> create a object of class A in the class B and then create another A-object in
> class C, what i have to do to all A-objects be the same and not two distint
> objects?
>
> Waocnek
> ---
> [Message sent by forum member 'Waocnek' (Brunno Silva)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageID=111426&#111426
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Anonymous

Gentlemen?

Anonymous

Thanks for the answer gentleman, but in fact, it just didn't help a lot, because my code and that one are too similar. I didn't find where is the problem with my.

messengers
Offline
Joined: 2004-04-18

>I need a Frame-like program that initiate full black in it content pane, with the capacity to take off this black color and put a 3D Scene when the user press a key, like "Enter" or "Space"

Put a black plane in front of the scene, lose it when the user presses a key. Switch is good for that.
regards

Anonymous

Thanks a lot, gentlemen. However, i still don't know how to make a behavior that works all the time, not only when the view's activation volume intersects the behavior's scheduling bounds. Another question to you: How can i define the axes of rotation? I looked for that asnwer in tutorials, example codes and in Google Search, but i didn't find anything... I'm still looking for, but if you help me in this problem, i'm going to be grateful.

Waocnek

messengers
Offline
Joined: 2004-04-18

How can i define the axes of rotation?
yourTransform3D.set(yourAxisAngle4f)
i still don't know how to make a behavior that works all the time
In general, applications cannot count on behavior execution being synchronized with rendering. Behaviors that use WakeupOnElapsedFrames with a frame count of 0 are an exception to this general rule. Such behaviors will be executed every frame.

Anonymous

Thanks Gentleman. Another: Imagine this situation. The user's avatar is running when a bot shoot it in the back. The program uses a first-person camera. The computer will render the bot, even if it isn't showed by the camera? In case of a negative asnwer, the computer will "simulate" the bot existence and acting in the scene, only render (and showing) it, in fact, if the camera see it?

Anonymous

And another two: Is there any program like 3D Studio that works with Java3D? What's the best alternative to move my geometry in very delicated movements, now that the Morph class is going to be depreceated?

Anonymous

Gentlemen, may u answer my doubts, please?

aces
Offline
Joined: 2003-07-17

I guess Morph still is availble, but not supported (I mean no bug fix, improvements, etc) in next releases.

There are some 3DS loaders, I guess at least one of then supports animation, but I'm not sure. Use forun`s search tool to find better info.

There is also a LightWave lws loader supporting animation, but it just supports a old version (5.0 I guess)

kimerinn
Offline
Joined: 2003-10-27

> Gentleman,
>
> I just started in Java3D programming and i have 3
> doubts to you may answer, please:
>
> 1. Is there any actual commercial project using
> Java3D? For example, a game project?

Another one is Galaxy3D: http://galaxy3d.com.ua . Though it is for free now, but in future game registration will cost a money.

Anonymous

Thanks Gentlemen,

My english is not so good, so, let me show my code:

public class ComportamentoRoda extends javax.media.j3d.Behavior
{
private TransformaçãoRoda transformaçãoRoda;
private javax.media.j3d.Transform3D transformação;
private double ângulo;
private javax.media.j3d.WakeupOnElapsedTime tempo;

public ComportamentoRoda(TransformaçãoRoda transformaçãoRoda)
{
this.transformaçãoRoda = transformaçãoRoda;
transformação = new javax.media.j3d.Transform3D();
setSchedulingBounds(new javax.media.j3d.BoundingSphere(new javax.vecmath.Point3d(0.0, 0.0, 0.0), 100.0));
}

public void initialize()
{
ângulo = 0.0;
tempo = new javax.media.j3d.WakeupOnElapsedTime(100);
wakeupOn(tempo);
}

public void processStimulus(java.util.Enumeration enumeração)
{
ângulo = 0.1745 + ângulo;
transformação.rotZ(ângulo);
transformaçãoRoda.setTransform(transformação);
wakeupOn(tempo);
}
}

(Note: I'm portuguese, so part of my code is in my language)

In my first code, the object [i]transformação[/i] was used too in the class [i]TransformaçãoRoda[/i] ("WheelTranslation", in english). When i used the method rotZ, the object's translation gone to (0, 0, 0), so i changed it to the actual code. There's any way to change rotation without change tranlation?

Another question, but this one is only a private curiosity: How can i determinate the translation of a TransformGroup? Has this class any "getTranslation" method ? I didn't find nothing like that.

Waocnek

nstark@mmm.com

To change rotation without changing translation, you need to multiply your
original transform by a rotational transform. Let's say that your current
wheel transform is stored as wheelTransformT3D. Then when you want to
rotate the wheel, you could make another transform called rotateT3D and do
something like the following:
rotateT3D = new Transform3D();
rotateT3D.rotZ(0.1745);
wheelTransformT3D.mul(rotateT3D);

This will rotate your current transform by 0.1745 radians about the objects
z axis (leaving all translational and scale components unchanged). Hope
that helps a bit.

As far as your second question, is is not difficult to get the translation
of a transform group object. Below is a code snippit showing how:

Vector3d translation = new Vector3d();
Transform3D transform = new Transform3D();
transformGroup.get(transform);
transform.get(translation);

The translation will now be in the vector 'translation'.

Nick

java3d-interest@j
avadesktop.org
To
08/30/2005 09:29 interest@java3d.dev.java.net
PM cc

Subject
Please respond to Re: Beginner's Doubts
interest@java3d.d
ev.java.net

Thanks Gentlemen,

My english is not so good, so, let me show my code:

public class ComportamentoRoda extends javax.media.j3d.Behavior
{
private TransformaçãoRoda transformaçãoRoda;
private javax.media.j3d.Transform3D transformação;
private double ângulo;
private javax.media.j3d.WakeupOnElapsedTime tempo;

public ComportamentoRoda(TransformaçãoRoda transformaçãoRoda)
{
this.transformaçãoRoda = transformaçãoRoda;
transformação = new javax.media.j3d.Transform3D();
setSchedulingBounds(new javax.media.j3d.BoundingSphere(new
javax.vecmath.Point3d(0.0, 0.0, 0.0), 100.0));
}

public void initialize()
{
ângulo = 0.0;
tempo = new javax.media.j3d.WakeupOnElapsedTime(100);
wakeupOn(tempo);
}

public void processStimulus(java.util.Enumeration enumeração)
{
ângulo = 0.1745 + ângulo;
transformação.rotZ(ângulo);
transformaçãoRoda.setTransform(transformação);
wakeupOn(tempo);
}
}

(Note: I'm portuguese, so part of my code is in my language)

In my first code, the object [i]transformação[/i] was used too in the class
[i]TransformaçãoRoda[/i] ("WheelTranslation", in english). When i used the
method rotZ, the object's translation gone to (0, 0, 0), so i changed it to
the actual code. There's any way to change rotation without change
tranlation?

Another question, but this one is only a private curiosity: How can i
determinate the translation of a TransformGroup? Has this class any
"getTranslation" method ? I didn't find nothing like that.

Waocnek
---
[Message sent by forum member 'Waocnek' (Brunno Silva)]

http://www.javadesktop.org/forums/thread.jspa?messageID=110237&#110237

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

aces
Offline
Joined: 2003-07-17

in portuguese:
A sugestão dada pelo post do nick é coerente, seria o mesmo que eu faria.
Dica : evite usar acentos em nomes de variáveis. vc pode ter sérias dores de cabeça mais tarde...

Anonymous

Gentlemen,

In fact, i did it before, however, doesn't it means that i shall create a new object always, do it? Isn't there other way to change the rotation without lose perfomance and time creating new objects always?

And, please, asnwer another curiosity: Are the behaviors only used when it's bounds intersect the ViewPlataform's activation volume? There's any way to break this rule?

Que tipo de problemas ocorre com os acentos? Até hoje, pelo menos, nunca tive problema algum de compilação ou execução ao usar-los.

Waocnek

messengers
Offline
Joined: 2004-04-18

If you are worried about a performance hit creating objects on-the-fly then create them on initialization and reference them from an array.
If you need to limit the influence of a scheduling bounds object then make it smaller.
Hope helps
:-)s

Anonymous

Is there any way to a object from a class always be the same? I mean, if i create a object of class A in the class B and then create another A-object in class C, what i have to do to all A-objects be the same and not two distint objects?

In fact, i don't want to limit the influence, but i want the behavior works all the time, not just when the activation's volume intersects it's bounds.

Waocnek

Sami Dalouche

Hi,

what you are asking is a general java question, which is not specific to Java3D,
right ?

If you want to only have one instance of class A in your whole application, you
can use the "Singleton" design Pattern.

Basically :
class A {
private static A objA;

private A(){
// constructor
}

public static A getInstance(){
if (objA == null}
objA = new A();

return objA;
}

}

You can find more information about this design pattern on the web.

Regards,
Sami Dalouche
Selon java3d-interest@javadesktop.org:

> Is there any way to a object from a class always be the same? I mean, if i
> create a object of class A in the class B and then create another A-object in
> class C, what i have to do to all A-objects be the same and not two distint
> objects?
>
> Waocnek
> ---
> [Message sent by forum member 'Waocnek' (Brunno Silva)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageID=111426&#111426
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

cai
Anonymous

Before i continue with my previous doubt, i'd like to show this new one:

package realidadevirtual;

public class Texturas extends java.applet.Applet
{
private static Texturas texturas;
private static javax.media.j3d.Texture2D[] textura;

private Texturas()
{
com.sun.j3d.utils.image.TextureLoader carregador;
javax.media.j3d.ImageComponent2D imagem;
textura = new javax.media.j3d.Texture2D[6];

for(int x = 0; x < 6; x++)
{
carregador = new com.sun.j3d.utils.image.TextureLoader(x+".jpg", this);
imagem = carregador.getImage();
textura[x] = new javax.media.j3d.Texture2D();
textura[x].setImage(0, imagem);
}
}

public Object clone() throws CloneNotSupportedException
{
throw new CloneNotSupportedException();
}

public static synchronized Texturas getTexturas()
{
if(texturas == null)
{
texturas = new Texturas();
}

return texturas;
}

public static synchronized javax.media.j3d.Texture2D textura(int qual)
{
return textura[qual];
}
}

When i use the getTexturas method, the exception throwed is java.lang.IllegalArgumentException

Any ideia of what's going on?

pumpkin

Hello.

> 1. Is there any actual commercial project using Java3D? For example, a game
> project?

yes, one example is Tribes.

> How is the Java3D current overall status in virtual reality
> commercial world? There's any better option in this market niche?

Sure. java3d is a rapid devel. system for 3D and mainly used in sci. and
education. There are "better" systems out there, but none of them is so
highlevel and cross-platform.

> 2. Are there any "Java3D Certification"?

no, just java certification (J2EE).

> 3. Now a program problem. I wasn't able to create a program to create two
> bike wheels. Everything works corretly, but i have to put a Transform Group
> inside of another one. One is the normal one, used to rotate in Z axis. The
> other, however, is used to put in the correct translation.

No problem so far.

> If i use only
> one, after rotate the first time, the whells go to point (0, 0, 0).

java3d does not reset transformation like that. The reset-to-zero call is
inside your code.

> I now
> that the compile method fits it, but without this, my program's
> initialization receive a bonus of about 50% in time.

??

> So, i would like to
> know if there's a way to fix it without the compile method and if the
> compile method is really useful in the end...

compile speeds up stuff. It does not change the way applications behave. You
are changing something else too.

cu

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Silvère Martin-Michiellot

pumpkin wrote:

>Hello.
>
>
>
>>1. Is there any actual commercial project using Java3D? For example, a game
>>project?
>>
>>
>
>yes, one example is Tribes.
>
>
>
Any link for this ?

Thanks.

>>How is the Java3D current overall status in virtual reality
>>commercial world? There's any better option in this market niche?
>>
>>
>
>Sure. java3d is a rapid devel. system for 3D and mainly used in sci. and
>education. There are "better" systems out there, but none of them is so
>highlevel and cross-platform.
>
>
>
>>2. Are there any "Java3D Certification"?
>>
>>
>
>no, just java certification (J2EE).
>
>
>
>>3. Now a program problem. I wasn't able to create a program to create two
>>bike wheels. Everything works corretly, but i have to put a Transform Group
>>inside of another one. One is the normal one, used to rotate in Z axis. The
>>other, however, is used to put in the correct translation.
>>
>>
>
>No problem so far.
>
>
>
>>If i use only
>>one, after rotate the first time, the whells go to point (0, 0, 0).
>>
>>
>
>java3d does not reset transformation like that. The reset-to-zero call is
>inside your code.
>
>
>
>>I now
>>that the compile method fits it, but without this, my program's
>>initialization receive a bonus of about 50% in time.
>>
>>
>
>??
>
>
>
>>So, i would like to
>>know if there's a way to fix it without the compile method and if the
>>compile method is really useful in the end...
>>
>>
>
>compile speeds up stuff. It does not change the way applications behave. You
>are changing something else too.
>
>cu
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Anonymous

> 1. Is there any actual commercial project using
> Java3D? For example, a game project?

not sure about "commercial", but you can look here:
http://wiki.java.net/bin/view/Javadesktop/Java3DUsers

messengers
Offline
Joined: 2004-04-18

Hi Brunno
I don`t understand the question, sorry. Perhaps you might be able to rephrase it?
s

aces
Offline
Joined: 2003-07-17

1. there are several.
2. As far as I know, there is no Java3D Certification
3. Sorry, but I did not understand your problem.

nitro
Offline
Joined: 2004-09-12

1. e.g. http://www.aec-ii.ch/forschung/index.html?bt/software.html (only Windows installer available)

Anonymous

I need a asnwer, in special to question 3, for the nexte 48 hours. Please, help me.

Waocnek