This is a little misleading.  The given code example is correct, but it
does not attempt to reuse the ImageComponent.  It creates a new image
component and assigns the new ImageComponent to the "image" variable.
Again, this will work correctly.

The answer to the original question, however, is that the Texture
object stores a reference to the ImageComponent so any change to that
ImageComponent will affect all textures that refer to it.  You can't,
for example, create a single 256x256 ImageComponent and use it with
two different texture objects with two different images.

--
Kevin Rushforth
Java 3D Team
Sun Microsystems

[EMAIL PROTECTED]


>Date: Fri, 1 Jun 2001 11:13:05 +0200
>From: Michael Nischt <[EMAIL PROTECTED]>
>Subject: Re: [JAVA3D] ImageComponent and Texture question
>To: [EMAIL PROTECTED]
>
>yes you can !
>
>the only thing you need twice is Texture2D.
>
>greetings
>Michael Nischt
>
>code-example
>//TEXTURE LOADING
>TextureLoader loader = new TextureLoader("./maps/sky.jpg","RGB", container);
>ImageComponent2D image = loader.getImage();
>Texture2D skyTexture = new Texture2D(Texture.BASE_LEVEL, Texture.RGB, 128,
>128);
>skyTexture.setImage(0, image);
>
>loader = new TextureLoader("./maps/texture.jpg","RGB", container);
>image = loader.getImage();
>Texture2D mapTexture = new Texture2D(Texture.BASE_LEVEL , Texture.RGB, 128,
>128);
>mapTexture.setImage(0, image);
>
>
>Am Freitag,  1. Juni 2001 11:00 schrieben Sie:
>> Hi all,
>>
>> can I reuse the ImageComponent object I use, after setting it to a
>> Texture object, i. e. does the Texture object hold a copy of the
>> ImageComponent object or a reference ?
>>
>> I have a lot of images with the same size and format and want to use as
>> little memory as possible.
>>
>> Thanks for answers !
>>
>> regards
>> Paul
>>
>> ===========================================================================
>> 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