Re: Specific alpha values

Andrew:

I believe that all values in your myColorTable array should be in the range
(0., 1.0), so you might want to use something like
((float(i)/float(dataDepth))...

tom


Andrew Donaldson wrote:
> 
> > You can do it with a ScalarMap to Display.RGBA. The
> > getControl() method for this ScalarMap will return a
> > ColorAlphaControl, and you can call its setTable() method
> > to set the 4-component lookup table for red, green, blue
> > and alpha. See Sections 4.6 and 4.11 of the tutorial for
> > more details.
> 
> Hey, that was really obvious now that you point it out!
> Thanks guys.  It's not working at the moment, I can certainly
> change the colours, but the alpha doesn't change.  Is it something
> to do with me using ImageRendererJ3D?
> 
> My code is:
>                 // Add a scalarMap to map the samples to RGBA
>                 ScalarMap range2D = new ScalarMap(
>                                 (RealType)rtype.getComponent(0),
>                                 Display.RGBA);
>                 display.addMap(range2D);
> 
>                 // Create a RGBA lookup table
>                 final int dataDepth = 16;
>                 myColorTable = new float[4][dataDepth];
>                 for(int i=0; i<dataDepth; i++) {
>                         myColorTable[0][i]= (float)0;   // red
>                         myColorTable[1][i]= (float)0;   // green
>                         myColorTable[2][i]= (float)i;   // blue
>                         myColorTable[3][i]= (float)i;   // alpha
>                 }
>                 // This does change the background to grey
>                 myColorTable[0][0]= (float)0.5;
>                 myColorTable[1][0]= (float)0.5;
>                 myColorTable[2][0]= (float)0.5;
>                 myColorTable[3][0]= (float)0.5;
> 
> //              ColorControl control
> (ColorControl)range2D.getControl();
> //              control.initGreyWedge();
> //              control.initVis5D();
>                 ColorAlphaControl control
>                         (ColorAlphaControl)range2D.getControl();
>                 control.setTable(myColorTable);
> 
> thanks again,
> 
> Andrew.
> 
> --
>  Andrew Donaldson
>  Email:   A.Donaldson@xxxxxxxxxx                Bureau of Meteorology
>  Phone:   +61 3 9669 4537            P.O. Box. 1289K/150 Lonsdale St,
>  Fax:     +61 3 9669 4128                       Melbourne, Australia.

-- 
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Phone/VoiceMail: 608/262-2759
Fax: 608/262-5974


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: