Simple question: How to set a different image to each side of a 3D cube?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple question: How to set a different image to each side of a 3D cube?

alejandrorg
Hi all,

I'm very new in the use of Java 3D and I would like to know how to set, in a 3D cube, for each side a different image.

Currently I've the code to set an image as texture of the cube, but it applies the same image to all the sides. However, I would like to use different images for each side.

This is my code: http://pastebin.com/sexBx57K

Any clue?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Simple question: How to set a different image to each side of a 3D cube?

gouessej
Administrator
Hi

Do that:
((Shape3D)getChild(TOP)).setAppearance(ap0);
((Shape3D)getChild(LEFT)).setAppearance(ap1);
((Shape3D)getChild(RIGHT)).setAppearance(ap2);
((Shape3D)getChild(FRONT)).setAppearance(ap3);
((Shape3D)getChild(BACK)).setAppearance(ap4);
((Shape3D)getChild(BOTTOM)).setAppearance(ap5);

You should have looked into the source code, it was easy to guess. Java3D is open source, people should look at the documentation and the source code before asking any question here:
https://github.com/hharrison/java3d-utils/blob/master/src/classes/share/com/sun/j3d/utils/geometry/Box.java#L287
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Simple question: How to set a different image to each side of a 3D cube?

alejandrorg
Hi!

Thank you very much for your answer. Probably you are right about taking a look to the source code, I'll take into account for future problems.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Simple question: How to set a different image to each side of a 3D cube?

gouessej
Administrator
You're welcome. Sorry to be a bit harsh but it's important for me that each developer does some research before asking some questions here. We are a very few people to answer and we are all already very busy, we do our best. Best regards.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Simple question: How to set a different image to each side of a 3D cube?

alejandrorg
Don't worry at all. I perfectly understand :-)