I'd looked at that, but I don't know if they're syntactically the same.
(BTW - It was the 2nd solution from the j3d.org page that I
successfully used in another app. If you use the first one, you get a
warning about not using a template.) At first glance they didn't look
syntactically equivalent to me. That combined with the fact that I get
horrendous flicker with VisAD as-is made me assume they were definitely
not equivalent. So, trimming out extraneous stuff, we have this
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
cfg =
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
vs. :
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice d = e.getDefaultScreenDevice();
GraphicsConfigTemplate3D gct3d = new GraphicsConfigTemplate3D();
GraphicsConfiguration c = gct3d.getBestConfiguration(d.getConfigurations());
Everything is identical up to the call to getBestConfiguration(). The
J3D.org solution calls the method with a GraphicsConfigTemplate3D as an
argument, the VisAD solution calls it with
GraphicsDevice.getConfigurations(), which is an array of
GraphicsConfigurations. I have no idea what the effective difference
is, but there is a syntactic difference. I'll just go ahead and try the
J3D.org solution and see what happens. When I get a chance to get back
to this work (has to wait until next week due to the sudden eminent end
of another grant ;) ) I will let you know how the experiment turns out.
-john
Don Murray wrote:
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
--
john brecht
sri international
john.brecht@xxxxxxx
650 859 2325