Giuseppe,

Justin has written code that loads images for textures without using
TextureLoader.  I believe one of the main reasons Justin wrote his code
is specifically to avoid this issue of TextureLoader creating multiple
copies of the same image.  It does require the images are powers of two
though.  I imagine it wouldn't be too hard to duplicate Sun's code for
resizing images to a power of two (but maybe that's where the extra copy
comes from?).

- John Wright
Starfire Research

Giuseppe Fontana wrote:
>
> Thank you all for the assistance!
> I executed the environment using:
> " java -Xrunhprof:heap=all,file= etc... myClass"
> If I'm not wrong  I guess the problem is about a lot of retained image objects.
> The largest is generated at trace 14522 by java3D texture loader, into the process 
>stimulus of a Behavior that I use to change
> some textures.
> It looks like entire [B image arrays  are still "live" at the end of the program, 
>even if I call myuniverse....removeAllLocales!
> I included some parts of the output file. The "incriminated" trace is, of course, 
>14522.
>
> ************************************************************************************
> (.....)
> TRACE 14522:
> javax.media.j3d.ImageComponent2DRetained.set(ImageComponent2DRetained.java:80)
> javax.media.j3d.ImageComponent2D.<init>(ImageComponent2D.java:168)
> com.sun.j3d.utils.image.TextureLoader.getTexture(TextureLoader.java:613)
> myBehavior.processStimulus(AnimateBehavior.java:217)
> javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
>
> (.......)
> ARR f7ac328 (sz=524304, trace=14522, nelems=524288, elem type=byte)
>
> (........)
> SITES BEGIN (ordered by live bytes)
> Thu Feb 20 11:04:04 2003
>           percent         live       alloc'ed  stack        class
>
>  rank   self         accum    bytes       objs    bytes   objs    trace  name
>  1        27.91%   27.91%  7864560   15  7864560     15      14522  [B
>
> (..............)
> ********************************************************************************
> What do you think about these?
> Is TextureLoader retaining memory or what?
> And, by the way, is it there a way to bypass TextureLoader utility to load JPG 
>textures?
>
> Is it possible to:
> 1. Load a Buffered Image using ImageIO
> 2. Copy it into an ImageComponent2D
> 3. Create a Texture2D with the ImageComponent2D
> 4. Load the Texture into an Appearance
> ?
>
> As far as I know it is not!
> Texture2D setImage(.....) method is intented to load "mipmap" images, with fixed ( 
>power of 2) height anf width, and is not useful.
> Anyone can help?
> Thanks,
> Giuseppe
>
> ===========================================================================
> 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