I may be missing something here, but unless the texture is by reference, the
very act of 1doing appearance.setTexture() will create a retained version
for the engine (a copy basically). I don't think the clone really enters
into this at all. So what I am saying is that every call to the
setTexture() method will result in the texture being updated.
Dave Yazel
-----Original Message-----
From: Nader Wasfy Zaki [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 4:42 PM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] changing textures on the fly problem
Well, this does not explain this strange anomoly:
after changing the pixels, i set the texture of the appearance with the
texture of whose pixels i have retrieved; this does NOT change the
appearance texture though (as I have noticed and as you pointed out);
however, if i clone the texture (after i have modified the pixels) and set
the clone as the texture of the appearance, the textures do get updated;
this seems contradictory to what is supposed to be happening.
Here is what I am doing:
// get the pixels
pixels =
((DataBufferInt)((ImageComponent2D)textureArrayCurrent.getImage(0)).getImage
().getRaster().getDataBuffer()).getBankData();
// modify the pixels
// blah code here
// clone the texture whose pixels i retrieved above
Texture2D texCopy = (Texture2D)
textureArrayCurrent.cloneNodeComponent(true);
// set the texture of the appearance
appearance.setTexture(texCopy); // weirdly, this changes the texture
thanks for the previous quick reply but i am still a little confused,
nader
On Wed, 28 Mar 2001 12:11:55 -0800, Charmaine Lee <[EMAIL PROTECTED]>
wrote:
>Nader,
>
>
>Nader,
>
>>
>> pixels =
>> ((DataBufferInt)((ImageComponent2D)textureArrayCurrent[i][j].getImage(0))
>> .getImage().getRaster().getDataBuffer()).getBankData();
>>
> Pixel changes here will not be reflected to the texture.
> Note, when you do ImageComponent2D.set(bufferedImage),
> the bufferedImage data is copied into the ImageComponent2D object.
> The subsequent changes to the bufferedImage object will not be
> automatically reflected to the ImageComponent object and hence
> not reflected to the texture.
>
> What you can do is to double buffer the ImageComponent
> object, modify the buffered image data, set the buffered image data
> to the back ImageComponent object, and then set the texture
> image to the back ImageComponent object.
>
>
>
>
>Charmaine Lee
>Java3D Engineering Team
>
>
> ==========================================================================
>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".