Vladimir Olenin wrote:
> Hi,
>
> I ran into a very confusing and irritating problem. The deal is that
> though my quite complicated 3D scene _alone_ runs just fine even on
> NOT very powerful computers, it starts to crawl VERY slowly even on VERY powerful
> computers as soon as i add any GUI component to the game. Below is what i'm
> doing:
>
> 1) construct panel with some buttons and images
> 2) when user presses particular button, panel with Canvas3D is shown and 3D scene
> is being constructed
> 3) user drives around the 3D scene (i have realtime 3D game)
>
> Now, as it follows from the above, GUI, which is created in (1), is a
> SEPARATE panel. First i tried to use CardLayout in order to construct
> both Canvas3D and GUI panels first and after that simply switch
> between them. This resulted in awful, enormous drop in the performance
> of Java3D engine (from ~25fr/sec to ~1fr/sec). After that i decided to
> manually switch between panels (by means of add/remove component
> functions) - nothing changed. After removing GUI panel from the output
> area (applet instance), i set all its components to null, called
> removeNotify() function on it, .... - no effect.
>
> At last this thing 'helped': i DID create GUI panel with all
> components, but did NOT add the panel the output area - i just added
> Canvas3D from the very beginning. And this resolved the problem - the
> Java3D performance got back to normal. The only problem is that i
> still can't get any input from user :).
>
> The summary is:
>
> - any GUI, even on a separate panel, is not 'compatible' with Java3D,
> no matter how difficult GUI is or what components are used (either
> Swing or AWT ones)
>
> - it seems that the problem relates to 'visibility' of the components:
> unless they are not shown, Java3D performance is OK, but once
> they are on the screen, NOTHING, even destroying the peer, helps.
>
> - difficult to say, but it looks like performance drop is not the fault of GC (at
> least halts occur even when gc is inactive)
>
> I can only wonder what causes this problems and if it can be overcome
> somehow. I tried almost everything i could think of, but the problem
> remains. If anyone here knows where the problem is or has ever came
> across it, please, let me know. If anyone wrote something realtime
> with GUI and met no performance drop, let me know as well.
>
> Thanks a lot for any help or hint,
> vladimir
>
> >-----<===========>-----<
> -=V=-
> >-----<===========>-----<
>
> ===========================================================================
> 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".
Hi Vladimir,
I don't know if it's any help, but I didn't notice any change in performance when
leaving out the keyPanel in the code below. It's a medium complex j3d applet and the
frame rate is 20 running on a 450 MHz Pentium with a 8Mb TNT graphic card.
public void init()
{
setLayout(new BorderLayout());
myCanvas = new Canvas3D(null);
add("Center", myCanvas);
Panel keyPanel = new Panel();
add("South",keyPanel);
keyPanel.add(new Label("Frames (mSek):"));
keyPanel.add(frameField = new TextField("0", 4));
frameField.setEditable(false);
keyPanel.add(new Label("Tick (mSek):"));
keyPanel.add(tickField = new TextField("0", 4));
tickField.setEditable(false);
Button walkButton = new Button("Walk");
keyPanel.add( walkButton );
Button rotateButton = new Button("Rotate");
keyPanel.add( rotateButton );
Button cueButton = new Button( "Cue" );
keyPanel.add( cueButton );
walkButton.addActionListener( new ActionListener() {
// anonymous class implements ActionListener
public void actionPerformed( ActionEvent e)
{
===========================================================================
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".