> -----Message d'origine-----
> De: Vasilios Darlagiannis [mailto:[EMAIL PROTECTED]]
> Date: jeudi 9 septembre 1999 16:45
> �: [EMAIL PROTECTED]
> Objet: Re: [JAVA3D] Animated textures
>
>
> Hi Cazoulat,
> I had the same problems with you, when I was
> trying to animate the textures very fast. I thing that
> the problem as you are also mentioning is in the thread
> synchronization, where probably one thread is running
> out of data.
> Anyway, with the current version of Java 3D, you
> have to slow down. Forget the double texture technique
> where you are preparing the one and you display the other.
> I tried that also but it didn't work.
> What you have to do is try to control the texture update
> with the rate of the updates of the canvas3d. What follows is
> the response that I have from SUN for this problem, where
> they were proposing another way to solve, temporarily this
> problem. The future version of Java 3D will be better.
>
> Vasilios Darlagiannis
> ----------------------------------------
> -----------------------------------------
>
> Bad news and good news. The bad news is that you found a bug
> in our code.
> The good news is that there is a way to work around it. I
> have attached your
> modified program that shows the workaround. It basically
> uses the Canvas3D
> callbacks to set the texture reference. This works around
> the problem and
> also has the advantage of being synchronized with thw render
> thread. This
> ensures that you are doing texture setting at the same speed
> as the framerate.
> I also tested your original program against our "coming
> sometime soon" 1.2
> release, and the bug is fixed.
>
> Doug.
>
>
> > X-Accept-Language: en
> > MIME-Version: 1.0
> > To: Doug Twilleager <[EMAIL PROTECTED]>
> > Subject: Re: [JAVA3D] Animated textures
> >
> > Hi Doug,
> > I attach a simple test where the problem of setting the
> > texture of the Appearance object appears. I also attach
> > a simple image file. If you take a look in the output
> > window, a counter is printed. After some time it freezes.
> > Also, if you see the CPU Utilization in the task manager
> > you will see that it drops from 100% to 0%.
> > If you need any more info, please send me an e-mail.
> >
> > Thank you very much for your help,
> >
> > Vasilios Darlagiannis
> >
> >
> > Doug Twilleager wrote:
> >
> > > If you have a small test case of the freezing problem, please
> > > send it to [EMAIL PROTECTED] so we can look at it.
> > >
> > > Thanks,
> > > Doug Twilleager
> > > Java 3D Team
> > >
> > > > X-Accept-Language: en
> > > > MIME-Version: 1.0
> > > > Content-Transfer-Encoding: 7bit
> > > > Subject: Re: [JAVA3D] Animated textures
> > > > Comments: cc: Jeremy Smoler <[EMAIL PROTECTED]>
> > > > To: [EMAIL PROTECTED]
> > > >
> > > > Hi Jeremy,
> > > > I am working on a similar application, where I want to
> > > > display animated textures on Shape3D objects. In the
> > > > beginning I was using new ImageComponent and Texture
> > > > objects for every new texture. But, since Java3d classes
> > > > can not be cleaned-up, I was eventually running out of memory.
> > > > My new solution is to construct only on of those objects
> > > > in the beginning and reuse them. For the ImageComponent
> > > > object you can use the set(BufferedImage buf) and for the
> > > > Texture the setImage(int level, ImageComponent image).
> > > > Of cource, the Texture Object should not be part of the live
> > > > scene. So, you have to set the texture of the appearance
> > > > either to null or to another value, before you modify
> those objects.
> > > > The problem with this solution is that after some time
> > > > of random duration, the application freezes. The problem is
> > > > probably the Appearance object. I made some tests where I
> > > > was simply setting the texture of the Appearance object and
> > > > it was also freezing after a number of times (usually
> after 10000 to
> > > > 20000 times). There is a posibility that this is a bug
> of Java3D.
> > > > Please let me know if you use this solution, if you face the
> > > > same problems.
> > > >
> > > > Best regards,
> > > >
> > > > Vasilios Darlagiannis
> > > >
> > > >
> > > > Jeremy Smoler wrote:
> > > >
> > > > > Sorry if this is repetitive, I posted it a couple of
> weeks ago and
> > > > > didn't get an answer:
> > > > >
> > > > > Is there a faster / more efficient way to do animated
> textures than to
> > > > > create new ImageComponent and Texture objects every
> time a texture image
>
> > > > > changes? I can't find any documentation that says
> Java 3D does / doesn't
>
> > > > > support animated textures.
> > > > >
> > > > > -Jeremy Smoler
> > > > >
> > > > >
> ==============================================================
> =============
> > > > > 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".
> > > >
> > > >
> ==============================================================
> =============
> > > > 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".
>
>
>
>
>
>
> import java.applet.Applet;
> import java.awt.BorderLayout;
> import java.awt.event.*;
> import com.sun.j3d.utils.applet.MainFrame;
> import com.sun.j3d.utils.universe.*;
> import com.sun.j3d.utils.image.TextureLoader;
> import javax.media.j3d.*;
> import javax.vecmath.*;
> import com.sun.j3d.utils.geometry.Box;
> import java.awt.GraphicsConfiguration;
>
> public class AppearanceTest2 extends Applet {
> static class MyCanvas3D extends Canvas3D {
> Appearance app = null;
> TextureLoader tex = null;
> int count = 0;
> public void postSwap() {
> if (tex == null) {
> tex = new TextureLoader("./apimage.jpg", this);
> }
> app.setTexture(tex.getTexture());
> System.out.println("i: " + count++);
> }
>
> public MyCanvas3D(GraphicsConfiguration gcfg) {
> super(gcfg);
> }
> }
>
> static public Appearance app;
> static public BranchGroup objRoot, intermediate;
> static SimpleUniverse u;
> static AppearanceTest2 at;
>
> private BranchGroup createSceneGraph() {
> // Create the root of the branch graph
> objRoot = new BranchGroup();
> objRoot.setCapability(BranchGroup.ALLOW_DETACH);
> objRoot.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
> objRoot.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
> intermediate = new BranchGroup();
> intermediate.setCapability(BranchGroup.ALLOW_DETACH);
>
> // Create a bounds for the background and lights
> BoundingSphere bounds =
> new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
>
> // Set up the background
> TextureLoader bgTexture = new TextureLoader("bg.jpg", this);
> Background bg = new Background(bgTexture.getImage());
> bg.setApplicationBounds(bounds);
> objRoot.addChild(bg);
>
> // Set up the global lights
> Color3f lColor1 = new Color3f(0.7f, 0.7f, 0.7f);
> Vector3f lDir1 = new Vector3f(-1.0f, -1.0f, -1.0f);
> Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f);
>
> AmbientLight aLgt = new AmbientLight(alColor);
> aLgt.setInfluencingBounds(bounds);
> DirectionalLight lgt1 = new DirectionalLight(lColor1, lDir1);
Hi,
The problem in the example provided is that the postSwap method generates
itself
a new rendering, so a new call to postSwap.
How can I ask java3D to render a new frame without modifying something
(as I want to modify the java3D scenegraph in the postSwap method)
renaud
===========================================================================
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".