Re: Flicker

John-

Correct me if I'm wrong, but if you just create a DisplayImplJ3D
without passing in a GraphicsConfiguration,  VisADCanvasJ3D
eventually gets created with a null GraphicsConfiguration
and in that case, it uses the defaultConfig:

 public VisADCanvasJ3D(DisplayRendererJ3D renderer,
                GraphicsConfiguration config) {
   super(config == null ? defaultConfig : config);
   // super(config == null ? null : config);
   displayRenderer = renderer;
   display = (DisplayImplJ3D) renderer.getDisplay();
   component = null;
 }

which is defined as:

  private static GraphicsConfiguration makeConfig() {
    System.out.println("config = null");
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice d = e.getDefaultScreenDevice();
    // GraphicsConfiguration c = d.getDefaultConfiguration();
    GraphicsConfigTemplate3D gct3d = new GraphicsConfigTemplate3D();
GraphicsConfiguration c = gct3d.getBestConfiguration(d.getConfigurations());
    return c;
  }

which to me looks syntactically identical to the second
example in the FAQ. (I didn't fully understand which
approach the FAQ said to use).

Am I missing something?  Do you want to pass in a null
configuration?  If you do that, then you get a nasty
message that says in a future release, null will cause
an exception.

BTW, I'm using Java 3D 1.3 on Windows with JDK 1.3.1_01.

Don

John J Brecht wrote:

I'm experiencing terrible flicker with all of my Java3D apps, which I can correct using the tip presented in the j3d.org FAQ:
http://www.j3d.org/faq/running.html#flicker

So, I've managed to get this fix to work in applications where I am in control of the construction of the Canvas3D. Unfortunately, construction of a Canvas3D in VisAD (the VisadCanvasJ3D) is quite buried. My code largely consists of extensions to the VisAD spreadsheet API. After much tracing, I see that a Canvas3D is ultimately constructed in the following way:

1. BasicSSCell constructDisplay() method constructs a new DisplayImplJ3D, constructing with just a name, or with a name and a TwoDDisplayRendererJ3D 2. If constructed with no VisADCanvasJ3D , DisplayImplJ3D constructs a VisADCanvasJ3D of its own.

As it happens, I am already overriding the constructDisplay() method in BasicSSCell in order to construct the DisplayImplJ3D with an extension of DisplayRendererJ3D of my own. I now want to extend VisADCanvasJ3D so that it is flicker free and use my extension of it in the construction of the DisplayImplJ3D. Should I use this constructor for the DisplayImplJ3D? :

public DisplayImplJ3D(String name, DisplayRendererJ3D renderer, int api,
                       GraphicsConfiguration config, VisADCanvasJ3D c)

where the DisplayRendererJ3D will be mine, the api argument is DisplayUmplJ3D.JPANEL, the GraphicsConfiguration will be the "best" configuration created as part of the safe Canvas3D construction process described in the FAQ above, and the VisADCanvasJ3D will of course be my extension created as per above?

-john



--
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************