Re: TGeo classes changing colors + OpenGL questions

From: Andrei Gheata <Andrei.Gheata_at_cern.ch>
Date: Thu, 20 Jul 2006 19:33:44 +0200


Hi Diego,
I'll answer just to the first part of your question: if the 2 nodes are represented by one volume in memory, the color is always the same since it is a volume property.
Cheers,
Andrei

Diego Faso wrote:
> Hi, I'm using the root-geometry and I need to change the color of some
> geometric elements. I will refer to the attached example (geom_example.C):
> I define a volume (CONE) and I use it to build two nodes under the top
> volume, then when I run the geom_example.C macro I see two separated
> cones. Now I need to change the color for one cone only and I don't know
> how to do it. I tried with the following commands:
>
>

>>gGeoManager->GetTopVolume()->GetNode(0)->GetVolume()->SetLineColor(3)

>
>
> but the color is changed for both nodes.
>
> Concerning OpenGL I have two questions:
> 1) is there a way to update the OpenGL view? The only solution I've found
> until now is to re-call "gGeoManager->Draw("ogl")"
>
> 2) When I draw a TPolyMarker3D I obtain the expected result in the "c1"
> canvas, but not in the "ROOT's GL viewer": marker style and marker size
> seem not to be respected by the "ROOT's GL viewer". This the way I use
> to add the polymarker to the geometry shown by my "geom_example.C"
> macro:
>
>
>>TPolyMarker3D *pol = new TPolyMarker3D()
>>pol->SetPoint(0,1,1,1)
>>pol->SetMarkerStyle(4)
>>pol->SetMarkerColor(2)
>>pol->Draw()

>
>
> By the way, is "TPolyMarker3D" the best solution to display points in this
> case?
>
> Thank you in advance.
> Regards
> Diego
>
> --------------------------------------
> Here is my system configuration:
> OS: Gentoo Base System version 1.6.15
> kernel: 2.6.16-gentoo-r9
> gcc: version 3.4.6
> root version: 5.11/07
> --------------------------------------
>
>
> ------------------------------------------------------------------------
>
> void geom_example(){
>
> gSystem->Load("libGeom");
>
> TGeoManager *geom_example = new TGeoManager("geom_example","geom_example.C");
>
> TGeoMaterial *mymat = new TGeoMaterial("BERILLIUM",9.01,4,1.848);
> mymat->SetUniqueID( 5);
>
> TGeoMedium *mymed = new TGeoMedium("BERILLIUM",3,5,0,1,10,2,0.1000000E+11,0.2163378,0.2000000E-03,0.2261152E-01);
>
> TGeoRotation *myrot = new TGeoRotation("myrot",10,20,30);
>
> TGeoVolume *TOP_VOL = gGeoManager->MakeTube("TOP_VOL",mymed,0,210,350);
> TOP_VOL->SetVisibility(0);
>
> TGeoVolume *CONE = gGeoManager->MakePcon("CONE",mymed,0,360,12);
> ((TGeoPcon*)CONE->GetShape())->DefineSection(0,-124,0,6.55);
>
> gGeoManager->SetTopVolume(TOP_VOL);
> TOP_VOL->AddNode(CONE,1,gGeoIdentity);
> TOP_VOL->AddNode(CONE,2,new TGeoCombiTrans(0,0,-131.5,myrot));
> gGeoManager->CloseGeometry();
>
> gGeoManager->GetTopVolume()->Draw("ogl");
>
> }
Received on Thu Jul 20 2006 - 19:33:55 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET