Michael,
We're aware of the GC hit in updating attributes, such as in Material.
Java 3D 1.3 will address such issue, and you might want to take advantage of
the new isFrequent bit; see SceneGraphObject.setCapabilityIsFrequent(int bit)
in Java 3D 1.3 API Reference.
- Chien Yang
Java 3D Team.
> Delivered-To: [EMAIL PROTECTED]
> MIME-Version: 1.0
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
> Date: Tue, 9 Oct 2001 23:22:01 -0700
> From: "Michael P. McCutcheon" <[EMAIL PROTECTED]>
> Subject: [JAVA3D] Object allocation within Java3D implementation
> To: [EMAIL PROTECTED]
>
> Platform: Windows 2000 SP2
> CPU: 600 Mhz P3
> Memory: 512 MB PC 133
> Card: GeForce2 MX 400 32mb
> Drivers: NVidia 21.81
> Java Version: 1.3.1
> Java3D Version: 1.2.1_03 (OpenGL)
>
> I've got a program that has a wakeuponelapsedframes running. In this program,
I have hundreds of Shape3D's that get moved and scaled, get their transparency
set, and their emissive color set each frame. The translating/scaling is FAST
and does not seem to create any objects when
transformGroup.setTransform(transform3D); is called. However, whenever I
perform changes to transparency attributes and or material on a Shape3D's
Appearance, I get all kinds of garbage collecting going on (as evidenced with
-verbosegc). It seems that the two methods below create many objects in Sun's
implementation.
>
> transparencyAttributes.setTransparency(transpVal);
>
> and
>
> material.setEmissiveColor(redVal, 0.0f, 0.0f);
>
> This makes using them for performance critical code a bad idea. They do work
ok, and there are no memory leaks, but the garbage collector is just getting hit
pretty hard (it's running about once per half-second, for varying amount of
times, depending on how many objects are updated), and it's taking CPU from the
rest of my program. When I comment out these 2 lines, the program only runs GC
about once every 15 seconds.
>
> My question is, is there any way around this?
>
> Will the next version of Java3D (1.3) still create many objects when
transparency/material are modified? Can I rely on these methods to be efficient
in the future, or should I not use them for mass updates every frame and find
another way to do what I need to do?
>
> Thanks for any insight...
>
> Michael P. McCutcheon
>
===========================================================================
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".