Re: TGeo and visibility of nested volumes.

From: Andrei Gheata <Andrei.Gheata_at_cern.ch>
Date: Mon, 19 Feb 2007 15:33:08 +0100


Hi Valeri,

The picture that you get is what Brett wants but without my patch you do not see the inside volumes if you are not using Coin3D. I have done some work some time ago to make visualization have const (or almost const) access to TGeoManager, so one could produce several simultaneous views of the geometry. This has however some limitations yet: since TGeoPainter class (the one sending the filled buffers to viewers) is a single object, some global properties (as visible level) are the same for all views. Some more work needs to be done to spawn a TGeoPainter for each viewer.

Regards,
Andrei

Fine, Valeri wrote:

> Hello Andrei,
> Since with and without your corrections I got one and the same OpenGL picture
> http://root.bnl.gov/picture/db_hand.png
>  I am wondering whether this indicates some flaw within my viewer implementation
> What should one set to get two different renderings of one and the same geometry object simultaneously. For example, I want to get the 2 levels deep image on one screen and 4 levels deep image on another one.
>  
>  
> Thank you, Valeri
>  
>  
> 
> ________________________________
> 
> From: owner-roottalk_at_pcroot.cern.ch on behalf of Andrei Gheata
> Sent: Mon 2/19/2007 4:55 AM
> To: Brett Viren
> Cc: roottalk_at_pcroot.cern.ch
> Subject: Re: [ROOT] TGeo and visibility of nested volumes.
> 
> 
> 
> Hi Brett,
> 
> I modified your macro adding some explanations inside.
> 
> Cheers,
> Andrei
> 
> Brett Viren wrote:

>> Hi,
>>
>> I'm having trouble getting all nested volumes in a simple TGeo
>> geometry to be displayed. I think I am correctly following the
>> guidance given in the relevant FAQs in the user's manual but the best I
>> can get is the top level and one intermediate level volume to display.
>>
>> The attached is an example of what I mean. By changing the VisLevel I
>> can change the node I display, but never do intermediates show up.
>>
>> I've tried this with a few versions, the latest being 5.14/00.
>>
>>
>> Thanks,
>> -Brett.
>>
>> PS: and thanks for fixing that OpenGL bug!
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> void db_hand() {
>> const double pi = 3.14159268;
>>
>>
>> gSystem->Load("libGeom");
>> new TGeoManager("world","Nested box test");
>> TGeoMaterial *air_mat = new TGeoMaterial ("Air",1,1,0.01);
>> TGeoMedium *air_med = new TGeoMedium("Air",1,air_mat);
>>
>> TGeoMaterial *water_mat = new TGeoMaterial ("Water",18,10,1.0);
>> TGeoMedium *water_med = new TGeoMedium("Water",2,air_mat);
>>
>> TGeoVolume* top = gGeoManager->MakeBox("Top",air_med,1000,1000,1000);
>> gGeoManager->SetTopVolume(top);
>>
>> TGeoBBox* b1 = new TGeoBBox("b1",800,500,500);
>> TGeoVolume* v1 = new TGeoVolume("b1_vol",b1,water_med);
>> top->AddNode(v1, 1);
>>
>> TGeoBBox* b2 = new TGeoBBox("b2",750, 450, 450);
>> TGeoVolume* v2 = new TGeoVolume("b2_vol",b2,air_med);
>> v1->AddNode(v2, 1);
>>
>> TGeoBBox* b3 = new TGeoBBox("b3",700, 400, 450);
>> TGeoVolume* v3 = new TGeoVolume("b3_vol",b3,water_med);
>> v2->AddNode(v3, 1);
>>
>> TGeoBBox* b4 = new TGeoBBox("b4",650, 350, 400);
>> TGeoVolume* v4 = new TGeoVolume("b4_vol",b4,air_med);
>> v3->AddNode(v4, 1);
>>
>> TGeoVolume* vols[] = {top,v1,v2,v3,v4,0};
>> for (int ind=0; vols[ind]; ++ind) {
>>
>> vols[ind]->SetVisibility(true);
>> vols[ind]->SetVisLeaves(true);
>> vols[ind]->VisibleDaughters(true);
>> vols[ind]->SetLineColor(!ind ? 1 : (ind%2 ? 2 : 4));
>>
>> }
>>
>> gGeoManager->SetVisOption(0);
>> gGeoManager->SetTopVisible();
>> gGeoManager->SetVisLevel(4);
>>
>> gGeoManager->CloseGeometry();
>> top->Draw();
>> }

>
> Received on Mon Feb 19 2007 - 15:40:32 CET

This archive was generated by hypermail 2.2.0 : Mon Feb 19 2007 - 17:50:01 CET