Probelm with "SetTransparency"


I got some problems with using “SetTransparency”.
I draw 10 tubes in the openGL-viewer and want them to have different transparencies.

The code looks like this:

//creating the tubes for(Int_t i=0; i<10; i++) tube[i] = geom->MakeBox("Tubebox", Al, 2,2,100); ... ... //trying to set the transparency-levels for(Int_t k=0; k<10; k++) tube[k]->SetTransparency(k*10);

Unfortunately, all tubes are drawn with the transparency, which is set last.

Do you have any ideas how to solve this ?


For each transparency need other material !

void SetTransparency(Char_t transparency=0) {if (fMedium) fMedium->GetMaterial()->SetTransparency(transparency);} // *MENU*Jan

oh. what a shame.

but thanks for your answer.


[quote=“Akrasim”]oh. what a shame.

but thanks for your answer.

You can do what you want using the TVolume “flavour” of the ROOT geometry definion. It doesn’t require any extra material to be defined. However, I am not sure whether you can draw it (I mean transparency) with the built-in ROOT GL-viewer properly.
To get it right you will need the Coin3D based viewer.

See … nfId=13356 … nfId=13356

See: … /pr02.html Plate 18,19,20 also