NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hello, Andrew Donaldson wrote:
Hi, For some time many of us here at the Bureau of Meteorology have been aware of our VisAD apps changing colour for an unknown reason. I vaguely recall showing this to Bill when he last visited, but I am uncertain of this. It has recently become a problem, with some of our operational people wanting to choose specific colours, only to have them changed by our applications. On every computer we have tried it on (including Linux nvidia, windows opengl and windows directx) the fault occurs. Attached is a simple program which displays a yellow box. If you clickwith your middle mouse button, the yellow box becomes darker.
I've seen this too and reported on: http://www.unidata.ucar.edu/cgi-bin/getfile?file=/content/support/help/MailArchives/visad-list/msg05512.html (see also other emails on the same thread)but dismissed because I thought it had to do with other native j3D objects I was adding to the display (via dispRendenerer.getTrans().addChild())
Cheers, Ugo
This thought to be the same problem that our applications have. The sample program does not have any code to respond to a mouse button or change colours. Any help would be very greatly appreciated. I think we first need to work out if the problem is with java3d or VisAD. I don't have a good understanding of all the things that happen when the middle mouse button is pressed, hopefully someone else can add to this! thanks, Andrew. ------------------------------------------------------------------------ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.net.URL; import java.rmi.RemoteException; import visad.*; import visad.bom.*; import visad.java3d.*; public class ColourBug { private DataReferenceImpl dataReference; public ColourBug() throws Exception { DisplayImplJ3D display; ScalarMap latMap, lonMap; visad.java3d.DisplayRendererJ3D displayRenderer new TwoDDisplayRendererJ3D(); display = new DisplayImplJ3D("display", displayRenderer); lonMap = new ScalarMap(RealType.Longitude, Display.XAxis); latMap = new ScalarMap(RealType.Latitude, Display.YAxis); display.addMap(latMap); display.addMap(lonMap); RealType pixel = RealType.getRealType("PIXEL"); FunctionType functionType = new FunctionType( RealTupleType.LatitudeLongitudeTuple, pixel); Set domainSet = new Integer2DSet( RealTupleType.LatitudeLongitudeTuple, 2, 2); float[][] flat_samples = new float[1][2*2]; flat_samples[0][0] = 1; flat_samples[0][1] = 1; flat_samples[0][2] = 1; flat_samples[0][3] = 1; FlatField vals_ff = new FlatField(functionType, domainSet); vals_ff.setSamples(flat_samples); DataReferenceImpl data_ref = new DataReferenceImpl("data_ref"); data_ref.setData(vals_ff); Color colour = new Color(254,240,179); ConstantMap[] colourConstantMap = new ConstantMap[3]; colourConstantMap[0] = new ConstantMap(colour.getRed()/255.0f, Display.Red); colourConstantMap[1] = new ConstantMap(colour.getGreen()/255.0f, Display.Green); colourConstantMap[2] = new ConstantMap(colour.getBlue()/255.0f, Display.Blue); display.addReference(data_ref, colourConstantMap); // Swing stuff JFrame frame = new JFrame("ColourBug example program"); frame.getContentPane().add(display.getComponent()); frame.setSize(500, 500); frame.setVisible(true); } public static void main(String[] args) throws Exception { new ColourBug(); } }
-- l a t / l o n GmbH Aennchenstrasse 19 53177 Bonn, Germany phone ++49 +228 184960 fax ++49 +228 1849629 http://www.lat-lon.de http://www.deegree.org
visad
archives: