I found something that works well.  It is actually an adaptation of
something someone else sent on this list before.

I create two ImageComponent2D objects in my code.  Both point to the same
BufferedImage, and are by-reference.  I also have a variable that toggles
which ImageComponent2D I'm currently using.

Initially, I set my Texture2D to point to the first ImageComponent2D.

Every time I update my BufferedImage, I switch my control variable to the
other ImageComponent2D, call .set(bufferedImage) on it (which I'm allowed to
do because it's not live at that moment), then I call Texture2D.setImage()
with the new ImageComponent2D object.

It works very well, actually!  :)  I am very pleased with it.

-Donnie Pinkston


> -----Original Message-----
> From: Discussion list for Java 3D API
> [mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Rushforth
> Sent: Tuesday, June 05, 2001 8:23 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [JAVA3D] dynamically-updated textures
>
>
> In Java 3D 1.2, the only way to modify the texture is by creating a new
> ImageComponent2D object, as you describe.  It is not legal to modify
> the BufferedImage directly.  In Java 3D 1.3, we are adding updateData
> methods to ImageComponent{2D,3D} and a new ImageComponentUpdater object
> that will allow you to modify all or part of a BufferedImage in place.
>
> --
> Kevin Rushforth
> Java 3D Team
> Sun Microsystems
>
> [EMAIL PROTECTED]
>
>
> >Date: Mon, 4 Jun 2001 18:55:08 -0700
> >From: Donnie Pinkston <[EMAIL PROTECTED]>
> >Subject: [JAVA3D] dynamically-updated textures
> >To: [EMAIL PROTECTED]
> >
> >I am wondering if the following is possible:
> >
> >I would like to have a BufferedImage object that is used by a
> by-reference
> >ImageComponent2D object, which is then part of a Texture2D that
> is used as
> >an object's appearance.  How can I get changes to the contents of the
> >BufferedImage to actually show up in the rendered scene?
> >
> >So far, the only way I can get changes in the BufferedImage to
> show up is to
> >hand the Texture2D a new ImageComponent2D object that is
> by-copy, every time
> >the BufferedImage changes.  This is very costly in terms of memory use!!!
> >
> >I have tried to get the by-reference ImageComponent2D to work,
> but changes
> >to the image referenced by the ImageComponent2D don't show up in
> the scene.
> >How can I get this to work?
> >
> >I know that there has to be a smart way to do this, but I cannot seem to
> >find it yet.  Any help would be greatly appreciated.
> >
> >-Donnie Pinkston
> >
> >=================================================================
> ==========
> >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".
>

===========================================================================
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".

Reply via email to