Hello,

    I spent a little while tracking down why my
canvas was updating continuously, despite the
fact that I have no behaviors in my scene. I
eventually removed every thing from the
scene and the canvas still rendered continuously.

finally, I realized that my calls to set the
front and back clipping planes were causing
the constant render. This occurs even if
the values you set the clip planes to are
the same as the ones set. For example:
 

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.media.j3d.*;
import com.sun.j3d.utils.universe.*;

public class Test {
 

  public static void main( String[] arg )
  {
    JFrame f = new JFrame( "J3D Test" );
    f.setSize( 600, 600 );
 
 
    Canvas3D canvas = new Canvas3D( null ) {
      public void update( Graphics g ) { paint( g ); }
      public void preRender( ) {
          getView().setBackClipDistance( 60000d );
          getView().setFrontClipDistance( 6d );
          System.out.println( "Pre" );
      }
      public void postRender( ) {
          System.out.println( "Post" );
      }
      public void renderField( int f ) {
         System.out.println( "Render" );
      }
      public void postSwap() {
          System.out.println( "Swap" );
      }
    };
    BranchGroup root = new BranchGroup();
    SimpleUniverse universe = new SimpleUniverse( canvas );
    universe.addBranchGraph( root );

    f.getContentPane().setLayout( new GridLayout( 1, 0, 10, 10 ));
    f.getContentPane().add(  canvas );

    f.setVisible( true );
  }
}

this will render continuously. If instead, I do

    if ( 60000d != getView().getBackClipDistance( ))
       getView().setBackClipDistance( 60000d );
    if ( 6d != getView().getFrontClipDistance( ))
       getView().setFrontClipDistance( 6d );

the rendering stops.

Not sure if i would consider this an error or not,
but it might be nice if J3D checked the new values
against the old ones and did nothing if they
were the same.
 

-Steve

-- 
------------------------------------------------------------
Stephen M. Jones                       Solipsys Corporation
Director of Visualization              (301) 483-8912
------------------------------------------------------------
 

Reply via email to